If I call getMeasuredWidth() or getWidth() for layout in onResume they return 0

前端 未结 7 2028
深忆病人
深忆病人 2020-11-28 09:10

If I call getMeasuredWidth() or getWidth() for layout in onResume they returns 0. I think that view it\'s not drawn yet in this moment.

Also I think that I need to

相关标签:
7条回答
  • 2020-11-28 10:01

    Use below code:

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
       super.onWindowFocusChanged(hasFocus);
       Log.e("WIDTH",""+view.getWidth());
       Log.e("HEIGHT",""+view.getHeight());
    }
    
    0 讨论(0)
提交回复
热议问题