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