我正在使用新設計庫開發Android應用程序。我想創建一個類似的滾動效果,用於新的Google Photos app。我希望AppBarLayout完全滾動屏幕,以便回收站視圖在狀態欄後面滾動。如何使AppBarLayout完全消失,並將windowTranslucentStatus設置爲true
我已經在應用程序的主題中將windowTranslucentStatus設置爲true。這裏的主要活動的XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
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"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
下面是這個樣子,當向下滾動,如:
工具欄不會完全消失。
感謝您的幫助!
我開始懷疑他們甚至使用了CoordinatorLayout ...我我一直被困在這個確切的問題上。 – timothyjc
@timothyjc如果您在我之前找到解決方案,可以將其發佈到此處。我認爲你是對的 – alesko007
上傳我的示例項目到github,以防萬一任何人想要輕鬆地看到問題... https://github.com/timothyjc/TestALot – timothyjc