Android 安卓-将一个图像部分放置在另一个图像之上

Android 安卓-将一个图像部分放置在另一个图像之上,android,layout,Android,Layout,我尝试放置两个图像视图- <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/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"
     />


图像之间有一些重叠。
动作图像与徽标重叠。
这是预期行为,因为它们在屏幕上都有一些公共空间

动作图像的顶部位于徽标的顶部,而我希望徽标的底部位于动作图像的顶部。
正在发生的事情-行动是最重要的

--

需要什么——行动应该放在后台


非常感谢您的帮助。

只需更改XML中2个图像视图的顺序即可。系统以相同的顺序绘制它们,所以无论您先放置什么,都会显示在底部。

只需更改XML中两个图像视图的顺序即可。系统以相同的顺序绘制它们,所以无论你先放什么,都会出现在底部。

试试这个。这会将顶部图像放置在背景图像的中心

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

试试这个。这会将顶部图像放置在背景图像的中心

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

使用RelativeLayout并更改图像视图的顺序。一切都会好起来的。利用RelativeLayout并更改图像视图的顺序。一切都会好起来的。