7
如何在我的Activity类中获取属性值“required”?Android:如何在Activity类中获取XML的自定义属性
1.值\ attrs.xml
<declare-styleable name="EditText">
<attr name="required" format="boolean" />
</declare-styleable>
2.布局\ text.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/com.mycompany.test"
android:baselineAligned="false"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/txtTest"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:inputType="text"
custom:required="true" />
你找到答案?我正在努力解决同样的问题:) – 2013-02-09 12:13:04