1
我试图显示全屏覆盖视图,第一步是设置带有隐藏覆盖层的xml,然后在适当时显示它。这里是我的布局:使视图重叠AppBarLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/appBar"
android:textColor="#FFFFFF"
android:text="Hello World!" />
<View
android:id="@+id/overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:background="#80FF0000"/>
</RelativeLayout>
这里是一个结果:
我需要得到这样的:
所以,我成功地重叠的所有除AppBarLayout之外的屏幕。如何让我的视图被放置在AppBarLayout后面?
嘿@WhiteNinja,是我的回答解决问题了吗? – Karoly
@ Karoly,nope ..我的问题是为什么用ID“overlay”查看不重叠AppBarLayout和如何解决它。 – WhiteNinja