0
我想创建一个黑色视图并将其放在另一个视图的顶部,如下图所示。到现在为止还挺好。将一个布局放置在屏幕底部的另一个布局上
但我不知道如何将黑色视图放置在屏幕底部? (仍然在白色背景PDF格式的顶部...)
这是到目前为止我的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/background_pdf"
android:layout_below="@+id/background_pdf2"
android:orientation="vertical"
>
<com.radaee.pdf.MLPDFViewer
android:id="@+id/pdf"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/background_pdf2"
android:orientation="vertical"
android:gravity="bottom"
android:layout_gravity="bottom"
>
<View
android:layout_width="match_parent"
android:layout_height="75px"
android:gravity="bottom"
android:layout_gravity="bottom"
android:background="@android:color/black"
/>
</LinearLayout>
</RelativeLayout>
如果我下面的代码添加到android:layout_alignParentBottom="true"
我android:id="@+id/background_pdf2"
结果是以下:
正如你可以看到黑色的观点被放置在机器人汤姆,但主视图(白色pdf)消失。我不明白这一点...
检查我的编辑答案。 Thx – user1293618
请在线性布局“background_pdf”中移除android:layout_below =“@ + id/background_pdf2” –