i've finished my layout for medium screen (5 inch i think), but i've trouble for adapting my drawable, button, and text for large and xlarge screen. How can i adapt them ? Please tell me step by step, because i feel very difficult for following many resource that i've got from many different resource and person. Thank you.
-
What have you tried? There are tools online to generate resources for multiple screen resolutions. – Absalón Valdés Aug 11 '15 at 07:02
-
@AnirudhSharma : i've try googling, but i always can't follow that instruction, because that instruction always skip any step – Fauzan Ramadhan Aug 11 '15 at 07:07
-
@absalon.valdes how i implement that resources (drawable) in my layout-large and layout-xlarge? – Fauzan Ramadhan Aug 11 '15 at 07:08
-
@FauzanRamadhan.You'll find your answer there only and these type of questions are already answered on so. – Anirudh Sharma Aug 11 '15 at 07:12
-
@FauzanRamadhan http://developer.android.com/guide/practices/screens_support.html :) – Absalón Valdés Aug 11 '15 at 07:13
-
refer [this](http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/) – shine_joseph Aug 11 '15 at 07:20
-
@FauzanRamadhan did you checked my answer ? – King of Masses Aug 11 '15 at 08:20
-
@AnirudhSharma oh ok ok... thank you, i'll try my best.... – Fauzan Ramadhan Aug 11 '15 at 12:33
-
@absalon.valdes ok ok thanks for your reference – Fauzan Ramadhan Aug 11 '15 at 12:33
-
@shine_joseph ok shine, i'll try your refer – Fauzan Ramadhan Aug 11 '15 at 12:33
-
@KingofMasses i'm sorry i just see your answer right now, and i'll try this.... i'm sorry – Fauzan Ramadhan Aug 11 '15 at 12:35
2 Answers
Firstly i strongly recommended you to go through the android developer docs for How to support multiple screen in Android and Supporting Different Screen Sizes
Coming to your question, 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. you could use different size of the layout files in res folder and also vary for drawable images based on the density..
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
You can use the following resource folders to create layouts for devices with larger screens : (for api level greater than 3.1 - mentioned here)
- layout-sw320dp
- layout-sw480dp
- layout-sw600dp
- layout-sw720dp
Your resource structure will be like this in your project
Coming to the conclusion of my answer, For supporting the multiple screen support there are different different ways is there, you need to find the better one among them.
Here is some approaches what you can try it !!
- Instead of different layout folders try to create a different values folders in your project and place the dimens.xml folders in it and place all your dimension values there. here is my answer
- Create the layout folder like mentioned in above answer and keep the respective xml files in such folders. It automatically takes from the respective folders for respective devices( ex; it will load the xml resources form layout-sw<600> folder for a 7'inch tablet) here you can get this approach
- Programatically differentiate your layout files for different set of devices (bit of difficult approach,but works) here is link

- 1
- 1

- 18,405
- 4
- 60
- 77
-
So, the conclusion is i must make resources for all different size screen, i must declare the size for all widget in @dimen. Am i wrong? – Fauzan Ramadhan Aug 11 '15 at 12:50
-
either one approach you can follow, or with a combination of both also you can follow but the thing is it depends on your usability – King of Masses Aug 11 '15 at 12:52
-
can i ask your email? so i can send you my project somewhen if i facing any troubles... – Fauzan Ramadhan Aug 11 '15 at 13:04
You have to change the size of the image for different screen sizes. Android takes the image automatically depending on screen size. The size of image for
ldpi is 36px * 36px
mdpi is 48px * 48px
hdpi is 72px * 72px
xhdpi is 96px * 96px
xxhdpi is 144px * 144px
You can get different sized images using online tools. Place proper images in different folders it will work fine.
Check this link for more information: http://developer.android.com/guide/practices/screens_support.html

- 2,354
- 4
- 22
- 45