开发者

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

  1. Any changes in the view like change in Screen Orientation
  2. Any changes in layout while scrolling or while hiding some widgets, this method will be called
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜