Cannot set TextView width using setWidth or setLayoutParams

来源:互联网 发布:开80端口 编辑:程序博客网 时间:2024/06/05 18:42

overflow中的解决方案:http://stackoverflow.com/questions/28089883/cannot-set-textview-width-using-setwidth-or-setlayoutparams?rq=1

从源码解释:http://stackoverflow.com/questions/20132048/when-to-use-setwidth-setheight-setlayoutparamsnew-linearlayout-layoutparamsw

翻译:看起来setheight并不覆盖内部高度参数,更多的只是布局的flag,

改变布局参数(实际上是引用view本身)去通知视图它需要那个高度

TLDR;setHeight更多用于文本的行高不是视图的高度

0 0
原创粉丝点击