I am beginner to programming for android. First of all i need that my app will be supported by 2 devices phone (480×800) and tablet (1280×800).
I read this and tried to do step by step.
Supporting Multiple Screens
So i created folders with layouts:
res/layout/firstPage.xml//this is by default phone layout port and land
res/layout-sw720dp/firstPage.xml//this is tablet port layout
res/layout-sw720dp-land/firstPage.xml//this is tablet land layout
My xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center_vertical"
android:baselineAligned="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:text="@string/button1" />
<Button
android:id="@+id/button2"
android:text="@string/button2" />
<Button
android:id="@+id/button3"
android:text="@string/button3" />
</LinearLayout>
I don’t give more info about button because in every layout they are different.
In my AndroidManifest.xml i have this line:
<supports-screens android:anyDensity="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:largeScreens="true"/>
Maybe i don’t need to set true for others if i set tru to this anyDensity=”true”
So i think i did everything as i should. But when i wanted to test on tablet it shows me layout by default of phone.
So what i missed ?
Or i need to do some coding also ?
Edited:
I think i understand why…
Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you should instead use the swdp configuration qualifier to define the smallest available width required by your layout resources.
My table is 3.1 so that why it didn’t find layout ?
But what to do if i want to support from 2.1 to 4 ?
Sollution:
You Should have to follow: Best Practise
Try to use the different layout for different screen size:
As like:
Use Different size of images as per the different Screen Size of device:
As Like:
Still if its not solve your problem then use the static size for the images for respective different layout.
As per my point of view and the Document it self explain that you should have to follow certain steps to do this.
Hope it will helps you. nd if not then let me know where you getting stop in managing layout.
Thanks.