将两个并排的ImageView居中

Kev*_*nT. 1 xml android android-layout android-xml

我想将两个图像视图居中,但是无法正常工作。目前我有:

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="goToMainMenu"
        android:src="@drawable/tw" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="goToMainMenu"
        android:src="@drawable/fb" />
Run Code Online (Sandbox Code Playgroud)

关于我必须添加哪些内容以使其居中的任何建议?

这是我要实现的目标,可以在底部设置一个特定的边距: 这就是我想要实现的

tam*_*jak 5

<RelativeLayout
    android:background="@drawable/red_android_background"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

        <LinearLayout
            android:orientation="horizontal"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="@dimen/somevalue">

                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="goToMainMenu"
                    android:src="@drawable/tw" />

                <ImageView
                    android:id="@+id/imageView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="goToMainMenu"
                    android:src="@drawable/fb" />
        </LinearLayout
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

ImageView如果两个的大小都不同,则可能需要为它们添加一个weight属性。