android - Difference in height of root Layout calculated from two methods -
android - Difference in height of root Layout calculated from two methods -
i calculating height of root layout ( relativelayout) height , width 'fill_parent'
using method , returns 690
final relativelayout rootlayout=(relativelayout)findviewbyid(r.id.root_layout); viewtreeobserver vto = rootlayout.getviewtreeobserver(); vto.addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { rootlayout.getviewtreeobserver().removeglobalonlayoutlistener(this); mrootlayoutheight=rootlayout.getheight(); toast.maketext(myactivity.this,""+mrootlayoutheight,toast.length_long).show(); } });
this layout has listview
calculate calculate 'bottom' of individual rows using this
for(int = 0; <= month_listview.getlastvisibleposition() - month_listview.getfirstvisibleposition(); i++){ view v=month_listview.getchildat(i); if(v!=null) { rect rectf = new rect(); v.getglobalvisiblerect(rectf); log.d("bottom :", string.valueof(rectf.bottom)); } }
the bottom of lastly row should come 690 coming 776. why there difference?
android listview
Comments
Post a Comment