tags:

views:

56

answers:

1

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?

+1  A: 

TypedValue lets you do unit conversions -- for example: http://developer.android.com/reference/android/util/TypedValue.html#applyDimension(int, float, android.util.DisplayMetrics)

hackbod
Thank you a lot!
furikuretsu