Ich baue gerade ein Bibliotheksprojekt und habe ein Problem mit den XML-Eigenschaften. Im Bibliotheksmodul habe ich die declare-styleable in attrs.xml
Android-XML-Zugriffe arbeiten nicht mit der benutzerdefinierten Bibliothek
<resources>
<declare-styleable name="betterTextViewAttrs">
<attr name="typefaceAsset" format="string"/>
<attr name="scaleWithinBounds" format="boolean"/>
</declare-styleable>
Und ich will die attrs in dem Projekt Probe Layout verweisen.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bettertv="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.virtualprodigy.bettertextviewsample.MainActivity">
<com.virtualprodigy.bettertextview.BetterTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
bettertv:typefaceAsset="dancing _script.ttf"
bettertv:scaleWithinBounds="false"
app:layout_constraintBottom_toBottomOf="@+id/activity_main"
app:layout_constraintLeft_toLeftOf="@+id/activity_main"
app:layout_constraintRight_toRightOf="@+id/activity_main"
app:layout_constraintTop_toTopOf="@+id/activity_main" />
Aber aus irgendeinem Grund die xmlns:bettertv="http://schemas.android.com/apk/res-auto"
nicht funktioniert. und ich bekomme den folgenden Fehler, wenn ich kompiliere.
Error:(11) No resource identifier found for attribute 'typefaceAsset' in package 'com.virtualprodigy.bettertextviewsample'
Die vollständige Quelle kann hier auf GitHub zu finden. Jede Hilfe wird geschätzt.