What is the main purpose of setTag() getTag() methods of View?
问题 What is the main purpose of such methods as setTag() and getTag() of View type objects? Am I right in thinking that I can associate any number of objects with a single View? 回答1: Let's say you generate a bunch of views that are similar. You could set an OnClickListener for each view individually: button1.setOnClickListener(new OnClickListener ... ); button2.setOnClickListener(new OnClickListener ... ); ... Then you have to create a unique onClick method for each view even if they do the