开发者

Hard-coding button's width in dimension units

开发者 https://www.devze.com 2023-01-09 23:29 出处:网络
I\'ve got the hard-coded layout, consisting of Buttons, and need to enlarge some of them. I found Button\'s method setWidth(int value), accepting width in pixels, but I need to set value in dp. So开发

I've got the hard-coded layout, consisting of Buttons, and need to enlarge some of them. I found Button's method setWidth(int value), accepting width in pixels, but I need to set value in dp. So开发者_如何学编程, how can I set dp value in program code?


TypedValue lets you do unit conversions - applyDimension (int unit, float value, DisplayMetrics metrics)

0

精彩评论

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