开发者

LinearLayout height in onCreate is 0

开发者 https://www.devze.com 2023-01-13 13:13 出处:网络
I\'m trying to dynamically adjust the height of my rows depen开发者_开发问答ding on the (screen height - my layout height) / list.size.

I'm trying to dynamically adjust the height of my rows depen开发者_开发问答ding on the (screen height - my layout height) / list.size.

Unfortunately in the onCreate method the layout height returns null (not so when i call it in an on click listener).

Is there another method I can call it in?


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

精彩评论

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