我要绑定一些额外的数据,以期。我正在使用我的XML文件中的标记,添加额外的信息。
I want to bind some extra data with a view. I am using tag in my xml file to add the extra information.
如果数据是唯一的字符串(机器人:标签=额外信息
),我能够通过使用 getTag来获得额外的数据()
在code。
If the data is only String (android:tag="extra Info"
), i am able to get the extra data by using getTag()
in code.
但我想多个数据对象绑定到一个视图,为我设置一个数组变量。
当我试图设置机器人:标签=@阵列/ xyz_array
,我仍然得到一个String对象,而不是一个数组从 getTag()
。
But i want to bind multiple data as object to a view, for that i am setting an array as tag.
When i tried to set android:tag="@array/xyz_array"
, I am still getting a String object instead of an array from getTag()
.
任何机构可以告诉我,如果我做错了什么?
Can any body tell me, if i am doing something wrong ??
您无法从XML做到这一点,XML支持的观点仅标签的字符串。
You can't do this from XML, XML supports only strings for view tags.