Wednesday 15 August 2012

android - Center items in listview vertically -



android - Center items in listview vertically -

i have listview, listviews width , height should set match parent. so, if listview stretched , has 2 items in it, @ top of listview , on bottom much useless space. want know, if possible center these 2 items in listview vertically, if yes, how?

list height depends on height of list item, populating list. if have 2 items in list why don't utilize linear layout instead weightsum?

anyway, if want accomplish result requested in question have display height using method

getresources().getdisplaymetrics().heightpixels in activity context.

after need set height of list item height retrieved before divided 2. , set gravity center_vertical textviews in list.

android listview

No comments:

Post a Comment