开发者

TextView.setHeight(); issues

开发者 https://www.devze.com 2023-03-26 12:13 出处:网络
I\'m trying to dynamically change the height of a TextView programmatically in Android/Java and I can seem to get it to work. I have tried invalidating the TV before hand with no luck. If I get the he

I'm trying to dynamically change the height of a TextView programmatically in Android/Java and I can seem to get it to work. I have tried invalidating the TV before hand with no luck. If I get the height after I have set it, it returns a value of 0 but still takes up the space on the layout set by the layout_height in the XML c开发者_开发百科ode.


It's some what confusing at first, but Views do not actually get defined a height until they are displayed and drawn on the screen. That's just how Android user interface works. Have you tried textView.getLayoutParams().height = (value here)?

0

精彩评论

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