Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中的多屏幕支持?_Android_Android Layout_Android Screen Support - Fatal编程技术网

android中的多屏幕支持?

android中的多屏幕支持?,android,android-layout,android-screen-support,Android,Android Layout,Android Screen Support,在我的应用程序中,有六个按钮,屏幕大小为4.65英寸720p(720X1280:xhdpi),设备从普通布局文件夹中获取此分辨率。当我在设备上运行它时,它显示如下图所示。如何根据布局宽度和高度将这六个按钮设置为适合屏幕。我不知道解决方案。任何人都知道,请帮我解决此问题 我的XML编码 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/

在我的应用程序中,有六个按钮,屏幕大小为4.65英寸720p(720X1280:xhdpi),设备从普通布局文件夹中获取此分辨率。当我在设备上运行它时,它显示如下图所示。如何根据布局宽度和高度将这六个按钮设置为适合屏幕。我不知道解决方案。任何人都知道,请帮我解决此问题

我的XML编码

 <?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>


您可以在本次优秀的官方培训中找到一些答案: 给你:

<?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:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/button3"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:text="Button" />

    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:text="Button" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/button3"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:text="Button" />

    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:text="Button" />
</LinearLayout>

</LinearLayout>


布局重量使按钮“共享”空间。

谢谢Stephane Mathis。