我有以下 XML:
<RelativeLayout android:id="@+id/cover_box"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:id="@+id/cover"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:id="@+id/download" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/mark_download"
android:layout_centerInParent="true" android:layout_marginTop="90px" />
</RelativeLayout>
但看起来 marginTop 被忽略了。
如果您希望第二张图像位于屏幕中心下方 90dp,您可以将其替换为 FrameLayout,您可以在其中控制填充以向下移动图像。
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingTop="90dp">
<ImageView android:id="@+id/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mark_download"/>
</FrameLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)