tag is an attribute of view, or a map that holds the parameters, which is useful for improving performance and parameter passing, such as improving ListView performance:
View that is used to cache item
Copy Code code as follows:
Public View GetView (final int position, View Convertview, ViewGroup parent) {
Itemviewholder Holder;
if (Convertview = = null) {
Holder = new Itemviewholder ();
Convertview = Layoutinflater.from (context). Inflate (R.layout.view_item, NULL);
Holder.timetextview = (TextView) Convertview.findviewbyid (r.id.text_item_content_time);
Holder.remarktextview = (TextView) Convertview.findviewbyid (R.id.text_item_content_remark);
Convertview.settag (holder);
} else {
Holder = (itemviewholder) convertview.gettag ();
}
if (Mmessagelistgroup.get mmessagelist.get (position). Getgroupid ()). Isshown ()) {
Convertview.settag (R.id.child_show, true);
}else{
Convertview.settag (R.id.child_show, false);
}
return convertview;
}
In the above code used to the tag, if it is a say directly settag can, if there are more than how to do?
Settag also has an overload with an int type, but setting a final type constant or writing a dead number appears:
The key must is an APPLICATION-SPECIFIC resource ID exception :
You need to define an ID in the Ids.xml file and set it here!!
The above is Android development Settag all the content of the magical, hope to give you a reference, but also hope that we support cloud habitat community.