android - Different View tree on different APIs -
i need views within activity , them in same way on phones , api versions. here how it:
private void walktroughviews(viewgroup group) { (int i=0; i<group.getchildcount(); i++) { view view = group.getchildat(i); if (something) { //do } if (view instanceof viewgroup) { viewgroup viewgroup = (viewgroup) view; walktroughviews(viewgroup); } } }
but results different based on api level or phone model(not sure yet) seems on 4.2 there 1 linearlayout , on >4.0 there frame layout not on 4.1 or 4.1. why , how can activity layout identical on phones? trying start method in ongloballayoutlistener
mactivity.getwindow().getdecorview().findviewbyid(r.id.content)
p.s. think might because of support-v4
library, why there spare linearlayout on 4.2?
libraries , native components of different apis can generate different layout. tab activity , action bar, progress bar , others. check viewtree using ui automator viewer, quite handy check this: http://developer.android.com/tools/debugging/debugging-ui.html , this: http://developer.android.com/tools/testing/testing_ui.html
Comments
Post a Comment