Need to rewrite
GridView and Baseadapter
public class Wrapgridview extends gridview{public Wrapgridview (context context) { super (context); } Public Wrapgridview (Context context,attributeset attributeset) { super (Context,attributeset); } Public Wrapgridview (context context, AttributeSet attrs, int defstyle) { Super (context, attrs, Defstyle); } @Override protected void onmeasure (int widthmeasurespec, int heightmeasurespec) {//This is the main code int Expandspec = Measurespec.makemeasurespec ( integer.max_value >> 2, measurespec.at_most); Super.onmeasure (Widthmeasurespec, Expandspec);} }
Class Autadapter extends Baseadapter {private list<map<string, object>> autlist = Autlist (); @Override public int GetCount () {return autlist.size (); } @Override public map<string, object> getItem (int i) {return autlist.get (i); } @Override public long getitemid (int i) {return i; } @Override public View getView (int i, view view, ViewGroup viewgroup) {autholder Autholder = Nu ll if (view = = null) {view = View.inflate (skillinfoactivity.this, r.layout.item_authentication, NULL); Autholder = new Autholder (); View.setlayoutparams (New Gridview.layoutparams (Sidew, Sidew));//This is the main control of the size of item AUTHOLDER.IV = (ImageView ) View.findviewbyid (R.id.skill); Autholder.tv = (TextView) View.findviewbyid (R.id.aut); View.settag (Autholder); } else { Autholder = (Autholder) view.gettag (); } map<string, object> autmap = GetItem (i); AutHolder.iv.setImageResource (Integer.parseint (Autmap.get ("img"). toString ())); AutHolder.tv.setText (Autmap.get ("title"). ToString ()); return view; } }
GridView Adaptive average Android interface