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.
Because supporting it doesn't mean it will autoscale it. You have to make "different" layouts depending on screensize and screendensity.
read this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.