[英]How to programmatically get an Image Button's width and height in Android
[英]How to get tab's content's height and width in android?
我想在第一個選項卡的活動中獲取選項卡內容,即框架布局的高度和寬度。 但它總是返回 0。我知道我們不能在 onCreate() 中調用 getHeight() 或 getMeasuredHeight() 因為視圖還沒有繪制,但是什么時候調用呢? 在活動中,我無法訪問 onDraw 或 onMeasure 方法,那么如何以及何時可以訪問高度和寬度?
http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html可以參考這個。...
注意: onGlobalLayout()
將被調用,如果有
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.