How to get tab's content's height and width in android?
I want to get the tab content i.e. framelayout's height and width in the first tab's activity. But it always returns 0. I know that we cannot call getHeight() or getMeasuredHeight() in onCreate() because the view isnt drawn yet, but then when to call it ? In activity I dont have acce开发者_如何学Goss to onDraw or onMeasure method, so how and when can I access the height and width ?
http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html You can refer to this ....
Note : The onGlobalLayout()
will be called if there is
- Any changes in the view like change in Screen Orientation
- Any changes in layout while scrolling or while hiding some widgets, this method will be called
精彩评论