I want to support my android screen in multiple screen sizes but i can do it with maintaining multiple xml layout file's
but according to requirement it i supposed to be done with the single XML layout in order to optimize the app usage.
so please can you help me i have gone through multiple tutorials multiple links but not able to get last option with stack overflow
If you provide text size as sp and other dimensions as dp. Android will automatically adjust for different layouts based on density of devices. If you want to control the values, you can put values in dimens.xml in each of values folders. The values folder inside res for different density devices will be following :
Create three different
Layouts Folder
in yourres
folder for all devices and use the dimensions accordingly.Generic Layout Folders
After you are done with making your Normal/Medium Layouts follow these steps:
For converting Values
For Example
Also new Qualifier has been introduced - SmallestWidth - AvailableScreenWidth - AvailableScreenHeight
read more about it here https://developer.android.com/guide/practices/screens_support.html
I hope this helps.
If you want to use single layout and that should support all the screens like ldpi, , mdpi, hdpi, x-hdpi, xx-hdpi then you have to use weight in your layout that will handle screen size for all the screens.
Here’re a few things: