android - Center A View using Java in AndroidStudio -
how can center view created in java? have following code in oncreate method of activity:
gridlayout gridlayout = new gridlayout(this); gridlayout.setcolumncount(5); gridlayout.setrowcount(5); (int = 0; < 25; i++) { imageview imageview = new imageview(this); gridlayout.addview(imageview, i); } setcontentview(gridlayout);
now, i'd gridlayout containing imageviews vertically centered on screen when program runs. how can this?
setlayoutparams(layoutparams);
set layout params gridview , imageviews. able check views clearly.
Comments
Post a Comment