简体   繁体   中英

Can you add additional String/Integer variables to android XML?

With a simple bit of Android XML:

<EditText
    android:id="@+id/editText"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp" >
</EditText>

Is there any way that you can add an additional String or Integer variable to the edit text field, such as an Integer called Section ID which can be set and called in the Java code. I am not talking about changing the "@+id" variable as there may be multiple Views with this variable. If so how could this be created/edited/called from within the java code itself.

为此使用setTag()getTag()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM