Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalence of setTag(key, value) in XML

Tags:

android

xml

view

I can use equivalence of setTag(key) at my Android layout files as this:

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

I would like to use equivalence of setTag(key, value) at my xml.

Is it possible?

like image 910
Cemo Avatar asked Jan 22 '13 22:01

Cemo


2 Answers

I'm a bit late to the party... but anyways you can do this from xml if you are using api level 21 or above. I am not sure whether the memory leak issue 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>
like image 161
psykid Avatar answered Oct 15 '22 17:10

psykid


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

like image 40
Milan Jurkulak Avatar answered Oct 15 '22 18:10

Milan Jurkulak