How to Set an array as Tag to any View through layout xml in android

后端 未结 2 1058
情话喂你
情话喂你 2020-12-20 23:50

I want to bind some extra data with a view. I am using tag in my xml file to add the extra information.

If the data is only String (android:tag=\"extra Info\"<

相关标签:
2条回答
  • 2020-12-21 00:07

    Actually you can do that if you define tag elements as a child for views. Define multiple Tag attribute for View in xml layouts

    <View ...>
         <tag android:id="@+id/mytag"
              android:value="@string/mytag_value" />
     </View>
    
    0 讨论(0)
  • 2020-12-21 00:08

    You can't do this from XML, XML supports only strings for view tags.

    0 讨论(0)
提交回复
热议问题