jerome collo
jerome collo

Reputation: 13

layout did not fit in different screen size

I have a layout for a game but it does not fit in different size of screen, although i have

<supports-screens android:smallScreens="true"
    android:normalScreens="true" android:largeScreens="true"
    android:anyDensity="true">
</supports-screens>

in my manifest and my xml file is set to fill_parent.

Here's one of my xml code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/mainlay"
    android:orientation="vertical" android:background="@drawable/menubackground">

    <Button
        android:id="@+id/cloud"
        android:layout_width="87dp"
        android:layout_height="57dp"
        android:background="@drawable/clouds" android:layout_marginTop="130dp"/>



    <Button
        android:id="@+id/newgame"
        android:layout_width="168dp"
        android:layout_height="63dp"
        android:layout_marginRight="7dp"
        android:layout_marginTop="50dp"
        android:background="@drawable/mainbuttoncontrol1" />


    <Button
        android:id="@+id/highscores"
        android:layout_width="166dp"
        android:layout_height="44dp"
        android:layout_marginRight="7dp"
        android:background="@drawable/mainbuttoncontrol3" />


    <Button
        android:id="@+id/settings"
        android:layout_width="165dp"
        android:layout_height="38dp"
        android:layout_marginRight="7dp"
        android:background="@drawable/mainbuttoncontrol4" />


    <Button
        android:id="@+id/instructions"
        android:layout_width="164dp"
        android:layout_height="61dp"
        android:layout_marginRight="7dp"
        android:background="@drawable/mainbuttoncontrol2" />

    <RelativeLayout android:layout_width="wrap_content" android:id="@+id/rl_onoff"
    android:layout_height="wrap_content">
<ImageView android:id="@+id/on_btn" android:layout_width="50dp"  android:layout_height="50dp" android:src="@drawable/soundon" android:visibility="visible" android:layout_alignParentBottom="true" android:layout_alignParentRight="true"></ImageView>
<ImageView android:id="@+id/off_btn" android:layout_width="50dp"  android:layout_height="50dp" android:src="@drawable/soundoff" android:visibility="invisible" android:layout_alignParentBottom="true" android:layout_alignParentRight="true"></ImageView>
   </RelativeLayout>

</LinearLayout>

Can you help me find why it does not fit in different screen size?

Thanks in advance.

Upvotes: 0

Views: 318

Answers (1)

Anders Metnik
Anders Metnik

Reputation: 6237

Because supporting it doesn't mean it will autoscale it. You have to make "different" layouts depending on screensize and screendensity.

read this

Upvotes: 2

Related Questions