I've never noticed before. ListView's GetView will repeat several times, this time because the layout is more complex, so in the test time to breakpoint tracking, found that the same data repeatedly executed. Feel very strange, so the internet search a bit. The interpretation of the network is basically consistent, that is ListView layout when the height and width are not fill_parent, resulting in constant calculation of the height, constantly refreshed. Or that its parent container is not set to Fill_parent.
Can be too complicated layout, all according to Fill_parent to adjust unrealistic. So think of another option, that is, dynamic fixed height.
After the program is run, fix the height of the ListView, and then initialize the item information.
Copy Code code as follows:
private void Fixedlistview () {
ListView = (ListView) Findviewbyid (R.id.listview);
Viewgroup.layoutparams params = Listview.getlayoutparams ();
Layout = (Horizontalscrollview) Findviewbyid (r.id.layout);
Params.height = Layout.getheight (); Need to set the height of the ListView, you can set to a fixed value, can also be set to the height of other containers, if the height of other containers, then do not perform in oncreate, need to do delay processing, or height of 0
Listview.setlayoutparams (params);
}
This shows that the speed of ListView refresh is greatly accelerated. Colleagues also solved the item in Chinese this input edittext if there is a Addtextchangedlistener (new Textwatcher () listening, resulting in multiple execution of the listening code.