0

私はメニューのようなアプリケーションに取り組んでおり、オプション付きのメニューの相対レイアウトは、画像を含む別の相対レイアウトでカバーされています。どこが悪いのか教えてもらえますか?現実的には、メニューを上部に、オプションを中央に、画像を下部に配置したいと思います。

これが私のxmlコードです:

<RelativeLayout
    android:id="@+id/RelativeLayout02"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android >

    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="false"
        android:contentDescription="@string/desc"
        android:scaleType="fitEnd"
        android:src="@drawable/half" />

</RelativeLayout>

<RelativeLayout
    android:id="@+id/RelativeLayout01"
    android:layout_width="match_parent"
    android:layout_height="247dp" >



    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:contentDescription="@string/desc"
        android:src="@drawable/paranoid_android" />

    <TextView
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_centerInParent="true"
        android:text="@string/menu"
        android:textColor="@color/white"
        android:textSize="@dimen/titlefont" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:contentDescription="@string/desc"
        android:src="@drawable/paranoid_android" />
</RelativeLayout>    

ありがとう。

4

1 に答える 1

0

すべてを1つの相対レイアウトにまとめるだけです。これが相対レイアウトの目的です。残りのコンポーネントの前または後に画像を追加して、コンポーネントの下または上に配置します。相対レイアウトは、1つのビューを移動しても、レイアウト内の他のビューの位置に影響を与えないように設計されているため、ビューを互いに重ねることができます。

于 2012-08-17T15:32:57.667 に答える