Search code examples
androidscreenscreen-resolution

Pre-Scaling and Supporting Different Size Screens Android


I am reading through http://developer.android.com/guide/practices/screens_support.html and trying to understand how pre-scaling works.

I have the following layout file which is optimized for the galaxy tab :

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayoutmain"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainmenu"
>
<ImageButton
android:id="@+id/start_button"
android:layout_marginLeft="150dip"
android:layout_marginTop ="70dip"
android:layout_width="500dip"
android:layout_height="214dip"
android:background="@drawable/startsession"
android:contentDescription="@string/descbuttonstart"
/>

I have placed the images for the screen in the drawable-ldpi folder. The problem is that when I test the app on a smaller screen (using the emulator) the screen does not scale properly - the button is massive and not positioned correctly.

Is it possible to just have one layout file for all screens and if so what is the secret to getting this working ?

Thank you.


Solution

  • NO , AFAIK its not possible you need to have three differents folders(hdpi,mdpi,ldpi) with different dimensions for buttons,images etc and also for layout again you need to have three layout folders (layout-small,layout-medium,layout-large)