1

私は2つのimageviewsを配置しようとしています-

<ImageView
    android:id="@+id/ivLogo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:focusable="true"
    android:layout_marginTop="20dp"
    />

<ImageView
    android:id="@+id/ivAction"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="110dp"
    android:layout_centerHorizontal="true"
    android:focusable="true"
     />


画像間に若干の重なりがあります。
アクション画像がロゴと重なっています。
どちらも画面上に共通のスペースがあるため、これは予想される動作です。

アクション画像の上部がロゴの上に表示されますが、ロゴの下部がアクション画像の上部に表示されるようにします。
何が起こっているのか-アクションが一番上にあります

- ここに画像の説明を入力してください

必要なもの-アクションはバックグラウンドに移動する必要があります

ここに画像の説明を入力してください

助けていただければ幸いです。

4

2 に答える 2

1

XML内の2つのImageViewの順序を変更するだけです。システムはそれらを同じ順序で描画するので、最初に置いたものはすべて一番下に表示されます。

于 2013-03-26T07:40:41.667 に答える
0

これを試して。これにより、一番上の画像が背景画像の中央に配置されます

<RelativeLayout 
android:layout_width="wrap_content"
android:layout_height="wrap_content"

<ImageView
    android:id="@+id/ivLogo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:focusable="true"
    android:layout_marginTop="20dp"
    />

<ImageView
    android:id="@+id/ivAction"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="110dp"
    android:layout_centerInParent="true"
    android:focusable="true"
     />
</RelativeLayout>
于 2015-11-05T04:24:20.773 に答える