I have a normal-hdpi-480×800 layout, which includes buttons and similar graphics. I mostly use RelativeLayout, since it’s recommended for better performance, and position my elements from the upper left bound relatively to each other. According to screens_support.html this group might also include 600×1024 resolution devices. So, when I test the application on LG L9 (540×960), which also falls into normal-xhdpi, it looks horrible – it seems there’s no difference between using pixels and dp. Here’s an example of code:
<Button
android:id="@+id/fb_post_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/share_fb_m_l"
android:layout_marginTop="@dimen/share_fb_m_t"
android:background="@drawable/fb_btn" />
Any help ? What I might be doing wrong ?
Thanks.
Just specify different dimensions in folders
values-ldpdi,values-mdpi,values-hdpi,values-xhdpiif you need more control over button sizes according to screen density. Like this:Update: You can get more control over this:
Specify multiple different images for different screen resolutions and densities. To do so read supporting multiple screens. If you need even more precision in image scaling and quality you can use the fundamental size of screen attribute which is swdp – you can specify the smallest width of the screen where your image should be used. This is a qualifier name for a resource folder.
Place your dimensions in these folders
values-sw540dp,values-sw540dp,values-sw600dp– these should serve as subfolders for more control.