Multiple screen support in android?
Posted
by
Yugesh
on Stack Overflow
See other posts from Stack Overflow
or by Yugesh
Published on 2013-06-29T10:18:54Z
Indexed on
2013/06/29
10:21 UTC
Read the original article
Hit count: 883
In my application have six buttons,the screen size is 4.65" 720p(720X1280 : xhdpi),device take this resolution from normal layout folder.when i run it in device.it display like the image am shown below.how to set this six buttons fit to the screen according to layout width and height.I don't know how to do.Can any one know please help me to solve this problem.
My XML coding
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_xml"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" >
<Button
android:id="@+id/btn_login"
android:layout_width="101dp"
android:layout_height="193dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageView1"
android:layout_marginLeft="4dp"
android:layout_marginTop="78dp"
android:background="@drawable/login_button" />
<Button
android:id="@+id/btn_order"
android:layout_width="101dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn_login"
android:layout_alignTop="@+id/btn_login"
android:layout_marginLeft="3dp"
android:layout_toRightOf="@+id/btn_login"
android:background="@drawable/order_button" />
<Button
android:id="@+id/btn_abtus"
android:layout_width="101dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn_order"
android:layout_alignTop="@+id/btn_order"
android:layout_marginLeft="3dp"
android:layout_toRightOf="@+id/btn_order"
android:background="@drawable/aboutus_button" />
<Button
android:id="@+id/btn_outlet"
android:layout_width="100dp"
android:layout_height="198dp"
android:layout_alignLeft="@+id/btn_login"
android:layout_alignRight="@+id/btn_login"
android:layout_below="@+id/btn_login"
android:background="@drawable/outlets_button" />
<Button
android:id="@+id/btn_feedback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn_outlet"
android:layout_alignLeft="@+id/btn_order"
android:layout_alignRight="@+id/btn_order"
android:layout_alignTop="@+id/btn_outlet"
android:background="@drawable/feedback_button" />
<Button
android:id="@+id/btn_games"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/btn_feedback"
android:layout_alignLeft="@+id/btn_abtus"
android:layout_alignRight="@+id/btn_abtus"
android:layout_alignTop="@+id/btn_feedback"
android:background="@drawable/games_button" />
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#98110e" >
</RelativeLayout>
© Stack Overflow or respective owner