java - select one column of GridView -
i have gridview 2 columns, arraylist fill out gridview. customadapter handle data between gridview , arraylist. gridview choicemode single in gridview xml file,and can select left column , right column both. want select left column , not right.
here gridview design xml :
<gridview android:layout_width="fill_parent" android:layout_height="330dp" android:layout_margintop="15dp" android:id="@+id/gridview" android:numcolumns="2" android:layoutdirection="rtl" android:foregroundgravity="center_horizontal" android:gravity="right" android:textdirection="locale" android:background="#e6b800" android:choicemode="singlechoice" android:layout_below="@+id/textview3" android:layout_alignparentleft="true" android:layout_alignparentstart="true" />
and here customadapter class :
public class customadapter<string> extends arrayadapter<string> { context contex; int id; arraylist<string> arraylist; public customadapter(context contex, int layoutid, arraylist<string> arraylist) { super(contex, id, arraylist); this.contex = contex; this.layoutid = id; this.arraylist = arraylist; } @override public boolean areallitemsenabled() { return false; } @override public boolean isenabled(int position) { return true; } @override public view getview(int position, view convertview, viewgroup parent) { return super.getview(position, convertview, parent); } }
and here usage of customadapter in class :
customadapter = new customadapter<string>(getapplicationcontext(), android.r.layout.select_dialog_singlechoice, mylist);
and here how fill out arraylist :
mylist.add(drivername); mylist.add(platenumber); customadapter.getitemviewtype(r.id.gridview); myadapter.isenabled(myadapter.getposition(platenumber)); mygridview.setadapter(customadapter);
drivername , platenumber string added listview
and after data entered list( after while loop ) added code prevent select both column, doesnt work :
customadapter.areallitemsenabled(); customadapter.isenabled(customadapter.getposition(platenumber));
again, changed solution. used 2 listview instead of 1 gridview 2 rows. , sync movement. if google, find out how sync 2 listview movement.
Comments
Post a Comment