1
我創建了自定義視圖以及相應的自定義屬性。例如android在自定義視圖上並排定義屬性和自定義屬性
<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」/>
我收到屬性文字空值。我也知道this,不知道如何解決這個問題。
爲了澄清,我需要獲得我的自定義屬性值以及android預定義的屬性值並排?
任何幫助?