カスタム ビューと対応するカスタム属性を作成しました。例えば
<declare-styleable name="stripbar">
<attr name="flowDirection" format="string"/>
</declare-styleable>
と
public Stripbar(Context context, AttributeSet attrs)
{
super(context, attrs);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.stripbar);
CharSequence flowDirection = ta.getString(R.styleable.stripbar_flowDirection);
String text = attrs.getAttributeValue("android", "text");
}
と
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ns="http://schemas.android.com/apk/res/com.ns">
<com.ns.Stripbar
android:id="@+id/aaa"
ns:flowDirection="RightToLeft"
android:text=”yoo hoo”/>
属性テキストに null 値が表示されます。私もこれを認識しており、問題を解決する方法がわかりません。
明確にするために、カスタム属性値とAndroidの定義済み属性値を並べて取得する必要がありますか?
何か助けはありますか?