Well, I have some issues showing ImageButtons in different dpi devices:
For example, If I have a .png button with 150x60 px. And try to use that button in my app, using layout_height = wrap_content
and layout_wid开发者_开发技巧th = wrap_content
the button seems to look bigger in a hdpi device.
To show the button in the real size I have to convert the size to dpi, for example:
layout_height = 100dp
and layout_width = 40dp
But I'm not very comfortable using hardcoded values in sizes.
I'm doing something wrong?
Many thanks for the help. And Sorry for my bad english :)
Usually I create three different sizes of my button images and store them in the res/drawable-ldpi, res/drawable-mdpi and res/drawable-hdpi to be used for low, medium and high density screens. This is discussed in http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
Well I decided to use 9-patch drawables to draw buttons :)
精彩评论