Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.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_Xml_Imageview_Scale - Fatal编程技术网

Android 在相对布局中缩放两个相邻的图像视图

Android 在相对布局中缩放两个相邻的图像视图,android,xml,imageview,scale,Android,Xml,Imageview,Scale,我为普通屏幕创建了main.xml。一切看起来都很好。 现在我尝试缩放图像视图以使用更大的屏幕。在顶部和底部缩放imageView没有问题,但它们之间有两个相邻的imageView main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_

我为普通屏幕创建了main.xml。一切看起来都很好。 现在我尝试缩放图像视图以使用更大的屏幕。在顶部和底部缩放imageView没有问题,但它们之间有两个相邻的imageView

main.xml:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" 
       >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:src="@drawable/bergsteiger2"
            android:layout_alignParentTop="true"
            android:adjustViewBounds="true"
            android:layout_above="@+id/start" />

         <ImageButton
            android:id="@+id/start"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_above="@+id/uebungen"
            android:background="?android:selectableItemBackground"

            android:src="@drawable/start"
            />

    <ImageButton
            android:id="@+id/anleitung"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/uebungen"
            android:layout_above="@+id/impressum"
            android:background="?android:selectableItemBackground"

            android:src="@drawable/anleitung"
            />
    <ImageButton
            android:id="@+id/uebungen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"


            android:background="?android:selectableItemBackground"
            android:layout_above="@+id/impressum"
            android:src="@drawable/uebungen"
            />



         <ImageButton
            android:id="@+id/impressum"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"


            android:background="?android:selectableItemBackground"
            android:layout_alignParentBottom="true"
                    android:layout_centerHorizontal="true"
            android:src="@drawable/impressum"
            />

    </RelativeLayout>

大型\main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/start"
        android:layout_alignParentTop="true"
        android:adjustViewBounds="true"
        android:src="@drawable/bergsteiger2" />

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/impressum"
        android:orientation="horizontal"


        android:layout_centerHorizontal="true"
        android:adjustViewBounds="true" >

        <ImageButton
            android:id="@+id/anleitung"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/uebungen"
            android:background="?android:selectableItemBackground"
            android:src="@drawable/anleitung" />

        <ImageButton
            android:id="@+id/uebungen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:adjustViewBounds="true"
            android:background="?android:selectableItemBackground"
            android:scaleType="fitXY"
            android:src="@drawable/uebungen" />
    </RelativeLayout>

    <ImageButton
        android:id="@+id/impressum"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:adjustViewBounds="true"
        android:background="?android:selectableItemBackground"
        android:scaleType="fitXY"
        android:src="@drawable/impressum" />

    <ImageButton
        android:id="@+id/start"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/relativeLayout1"
        android:layout_alignParentLeft="true"
        android:adjustViewBounds="true"
        android:background="?android:selectableItemBackground"
        android:scaleType="fitXY"
        android:src="@drawable/start" />

</RelativeLayout>


左视图是大视图,我想缩放“Übungen”和“Anleitung”

将这两个视图添加到线性布局中,使用sumweight属性。线性布局的宽度与父布局匹配,总权重为2。内部的两个图像的宽度均为0dp,权重均为1。您可以保留当前使用的页边距和所有属性。 这样:

<LinearLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/impressum"
        android:orientation="horizontal"
        android:layout_centerHorizontal="true"
        android:adjustViewBounds="true"
        android:weightSum="2">

        <ImageButton
            android:id="@+id/anleitung"
            android:layout_width="0dp"
            android:layout_weigth="1"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/uebungen"
            android:background="?android:selectableItemBackground"
            android:src="@drawable/anleitung" />

        <ImageButton
            android:id="@+id/uebungen"
            android:layout_width="0dp"
            android:layout_weigth="1"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:background="?android:selectableItemBackground"
            android:scaleType="fitXY"
            android:src="@drawable/uebungen" />
    </LinearLayout>

希望能有帮助