What is the main purpose of setTag() getTag() methods of View?

前端 未结 7 625
醉话见心
醉话见心 2020-11-22 01:25

What is the main purpose of such methods as setTag() and getTag() of View type objects?

Am I right in thinking that I can ass

7条回答
  •  醉酒成梦
    2020-11-22 01:58

    Unlike IDs, tags are not used to identify views. Tags are essentially an extra piece of information that can be associated with a view. They are most often used as a convenience to store data related to views in the views themselves rather than by putting them in a separate structure.

    Reference: http://developer.android.com/reference/android/view/View.html

提交回复
热议问题