There is a getview () in the Baseadapter adapter that needs to be rewritten
Public View getView (int position,view converview,viewgroup parent)
{
Omitted..
}
What does the three parameter of this method mean? What is the role? I don't want to be a simple translator, but I'd better give you a concrete example.
int position position, general Baseadapter are many types of data presented in the interface, the property is judged to be displayed on the interface is the number of, by position in the Baseadapter custom array or collection of values. and displayed on the interface.
View Converview displays an item on the interface. Because the mobile phone screen is so big, so a display to the user to see the content is fixed, if you list of 1000 data, should not new1000 a converview, so memory is not enough, you should learn the control reuse, The Converview that slides out of the screen is re-used in the new item below, just to change the value he shows.
The code is as follows:
View v = null;
if (Convertview = = null) {
v = layoutinflater.from (context). Inflate (
R.layout.adapter__item, parent, false);
Holder VH = new Holder ();
Vh.text = (TextView) V.findviewbyid (R.ID.TEXT1);
V.settag (VH);
} else {
v = convertview;
}
Holder VH = (Holder) v.gettag ();
Vh.text.setText (Data[position]);
return v;
ViewGroup Parent This property is used when the XML view is loaded.
Inflate (R.layout.adapter__item, parent, false); Determine his parent control, reduce the measurement of the width and height
What do the 3 parameters in GetView () in Android development baseadapter mean?