Now the interface is longer, do not know what you will have to deal with such a long interface, I still use the ListView or GridView to combine ScrollView to synthesize. Then, the problem comes, if you try to start, there will always be a phenomenon of sliding conflict.
So, what to do, I also see other people's reference to do. Write it down and you'll definitely use it in the future.
PackageCom.ky.utills;ImportAndroid.view.View;ImportAndroid.view.ViewGroup;ImportAndroid.widget.GridView;ImportAndroid.widget.ListAdapter;ImportAndroid.widget.ListView; Public classUtility { Public Static voidSetlistviewheightbasedonchildren (ListView listview) {ListAdapter ListAdapter=Listview.getadapter (); if(ListAdapter = =NULL) { //pre-condition return; } intTotalheight = 0; for(inti = 0; I < Listadapter.getcount (); i++) {View ListItem= Listadapter.getview (I,NULL, ListView); Listitem.measure (0, 0); Totalheight+=listitem.getmeasuredheight (); } viewgroup.layoutparams params=Listview.getlayoutparams (); Params.height=Totalheight+ (Listview.getdividerheight () * (Listadapter.getcount ()-1)); Listview.setlayoutparams (params); } Public Static voidSetgridviewheightbasedonchildren (GridView GridView,intnum) {ListAdapter ListAdapter=Gridview.getadapter (); if(ListAdapter = =NULL) { //pre-condition return; } intTotalheight = 0; intCount = 0; if(Listadapter.getcount ()% num = = 0) {Count= Listadapter.getcount ()/num; } Else{Count= Listadapter.getcount ()/num + 1; } for(inti = 0; I < count; i++) {View ListItem= Listadapter.getview (I,NULL, GridView); Listitem.measure (0, 0); Totalheight+=listitem.getmeasuredheight (); } viewgroup.layoutparams params=Gridview.getlayoutparams (); Params.height= Totalheight + (gridview.getheight () * ((count)-1)); Gridview.setlayoutparams (params); }}
, and then after Viewsetadapter, add this to okay:
Utility.setlistviewheightbasedonchildren (Game_listview);
Intact, today gave yourself a word: people live must have meaning
ListView and GridView with rolling conflict resolution