Search code examples
androidtextviewandroid-textattributes

Android: Why textView text attribute value is id?


<TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@+id/label"
    android:textSize="20px" >
</TextView>

this is part code of ListActivity with custom Layout. So it can dynamically set value. Why android:text="@+id/label" ? Have a any other use?


Solution

  • <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"   <-- wrong
        android:text="@string/label"   <-- get text from string.xml
        android:text="Label"     <-- direct text
        android:textSize="20px" >
    </TextView>