Reputation: 11331
I am currently working on an Android app. I am not an UI guy, and just trying out which number fits the best when I make the layout xmls like below:
<ImageView
android:id="@+id/my_icon"
android:layout_height = "30dp"
android:layout_width = "wrap_content"
android:layout_gravity = "center_vertical"
android:scaleType="centerCrop"
/>
I know that 30dp
will work ok on xxhdpi devices because that is what I am using and testing, but I think this will cause trouble when the screen resolution is lower (say, a mhdpi device).
I am wondering if there is any guideline on how to make a layout support different res?
Upvotes: 2
Views: 323
Reputation: 485
For Different screen size, The following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for small, medium, high, and extra high density screens.
res/layout/layout.xml
res/layout-small/layout.xml
res/layout-large/layout.xml
res/layout-xlarge/layout.xml
res/layout-xlarge-land/layout.xml
res/drawable-mdpi/icon.png
res/drawable-hdpi/icon.png
res/drawable-xhdpi/icon.png
The following code in the Manifest supports all dpis.
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
Upvotes: 0
Reputation: 4099
You can find giudelines in following links
How to support different screen size in android
http://developer.android.com/training/multiscreen/screensizes.html
http://developer.android.com/guide/practices/screens_support.html
http://developer.android.com/training/basics/supporting-devices/screens.html
Upvotes: 2
Reputation: 534
Here you can find some guidelines:
http://developer.android.com/design/style/devices-displays.html
Upvotes: 1