1
我正在使用FrameLayouts在图像上重叠图像,但我无法理解在这种特殊的情况下,我的内部FrameLayout不显示在另一个图像的前面。这里的理论:如何正确处理嵌套的FrameLayout
,这里是实际的事情:
因此,这里是我的XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mypage_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/cover_photo"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="120dp"
android:scaleType="fitXY"
android:src="#CCFF0000" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/cover_photo" >
<ImageView
android:layout_width="105dp"
android:layout_height="90dp"
android:layout_below="@id/cover_photo"
android:adjustViewBounds="true"
android:src="@color/aqua"
android:translationY="-45dp" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="15dp"
android:src="@color/green"
android:translationY="-40dp" />
</FrameLayout>
</RelativeLayout>
</FrameLayout>
有我放置在内的FrameLayout错误?我不知道该怎么做了。 任何帮助将深表谢意。谢谢!
我忘了忽略该行,但该行基本上没有影响布局,因为它的父级是FrameLayout。我删除了这一行,没有任何改变。尽管谢谢你的回答! –
对不起,我更新了我的答案,希望对你有所帮助。顺便说一句,为什么你有相对 - >框架 - >相对??为什么你不只有RelativeLayout? – koso
好的,我找到了解决方法。取代视图下方的视图并将其向上移动,将其对齐到底部并向下移动。辉煌!顺便说一句,我有什么其他的父母RelativeLayout,更多的ImageView和另一个RelativeLayout。这只是我整体布局的一部分。非常感谢! –