LinearLayout height in onCreate is 0

前端 未结 1 677
深忆病人
深忆病人 2020-12-01 01:18

I\'m trying to dynamically adjust the height of my rows depending on the (screen height - my layout height) / list.size.

Unfortunately in the onCreate m

相关标签:
1条回答
  • 2020-12-01 01:38

    You have to wait until layout happens, which is after onCreate(). You can do so by listening to onSizeChanged() on a View or by posting a Runnable from onCreate() (myView.post(new Runnable() { ... })).

    0 讨论(0)
提交回复
热议问题