Android: как получить настраиваемый атрибут XML в классе Activity

Как получить значение атрибута «требуется» в моем классе активности?

1. values\attrs.xml

<declare-styleable name="EditText"> 
    <attr name="required" format="boolean" />
</declare-styleable> 

2. layout\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" />

7
задан Deduplicator 10 February 2015 в 22:51
поделиться