this question has answer here:
- making gridview items square 12 answers
i have girdview of 9 textviews. want make 9 textviews distribute equally in height , width. fit gridview exactly. how can this?
this how add textviews gridview
string[] arrayempty = new string[] {"", "", "", "", "", "", "", "", ""}; arraylist<string> list = new arraylist<string>(arrays.aslist(arrayempty)); gridview.setadapter(new arrayadapter<string>(this,r.layout.list_item,list));
this have got
i tried use gridview.layoutparams
not. me distribute them equally
i have overrided method onmeasure, did not work
import android.content.context; import android.util.attributeset; import android.widget.gridview; public class mygridview extends gridview { public mygridview(context context) { super(context); } public mygridview(context context, attributeset attrs) { super(context, attrs); } public mygridview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } @override public void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, widthmeasurespec); } }
check this
it's open source project in git hub.here can find layout , source code sudoku.i hope you.
Comments
Post a Comment