Equivalence of setTag (key, value) in XML

I can use the setTag(key) equivalence in my Android layout files like this:

  <EditText android:id="@+id/passwordEdit" android:tag="key" android:inputType="textPassword"/> 

I would like to use the setTag(key, value) equivalence in my xml.

Is it possible?

+8
source share
3 answers

I would like to use the setTag equivalence (key, value) in my xml

Not.

Also, be careful using the two-parameter setTag() implementation, as it may lead to a memory leak .

+3
source

I'm a bit late to the party ... but anyway you can do it from xml if you use api level 21 or higher. I'm not sure if the memory leak problem is still present or not.

 <Button android:layout_width=match_parent android:layout_height=wrap_content android:text="New button" > <tag android:id="SomeId" android:value="SomeValue" /> </Button> 
+10
source

There is this: <tag android:id="..." android:value="..."/>

0
source

All Articles