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
Well that depends on your code
Drawables
Use everyDPI
FolderLook at these Links
1)https://developer.android.com/training/multiscreen/screensizes.html
2)How to support different screen size in android
3)Supporting multiple screen size - Android
May be you can try below library which manages all the screen size resolution automatically.
You need to just add the dependency in your build.gradle file and you are done.
You need to specify like:
Instead of usual:
drawable:
For images, you have to manage different drawable folders as per screen resolution:
dimes: For dimens, If you are using different static dimes as per your UI then you have to define them respected to their values... folders.
Values folder for different smart phones resolutions:
Note: If you are using sp/sip/dp/dip then these values will be adjusted based on the density of device. e.g Suppose you had set 10sp for TextView in mdpi(320X480) resolution device. Then this same value will be auto adjusted for other resolutions.
These are the some general usage values folder which are used to manage dimens related to their screen resolutions.
Different values folder for different screens:
For knowledge in depth go with Support screen resolution
There are three ways to do this :
1) Put your images and icon in different
drawable
folder includingdrawable-mdpi
,drawable-hdpi
,drawable-xhdpi
,drawable-xxhdpi
,drawable-xxxhdpi
which will be access image from particular folder based on screen resolutions. Don't apply fixed values everywhere for image. Fixed dimensions can be vary with different device and image will be looked stretch. So use wrap_content2) Set dimensions in
dimens.xml
for differentvalues
folder.3) Use
LinearLayout
with proper using ofandroid:layout_weight
.You can define multi dimen files, and add dimensions of each view according to screen size in there. You can find detailed answer here
A set of six generalized densities:
Here is the official docs
try this https://developer.android.com/guide/topics/manifest/supports-screens-element.html