开发者

Hard-coding button's width in dimension units

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜