2017-04-18 55 views
-2

那么出于某种原因,我想为xml布局中的特定索引(键)分配标记值。如何在android中为XML布局指定特定索引的标签值?

<View 
android:layout_width="match_parent" 
android:layout_height="60dp" 
android:tag="someTextPutFor someIndex" //how to assign this value for specific key 
/> 

所以我可以简单地检索使用

someView.getTag(someIndex); 

谢谢你该值。

回答

1
<View 
android:layout_width="match_parent" 
android:layout_height="60dp"> 
<tag android:id="SomeId" android:value="SomeValue" /> 
</View> 
+0

得到输出兄弟 –

+0

是的,谢谢你的完美工作... –