0
我正在使用CoordinatorLayout而回收視圖開始滾動AppBarLayout是隱藏的視差效果。直到我完成了。我正在粘貼下面的代碼。如何創建自定義佈局行爲recyclerview內CoordinatorLayout
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:paddingBottom="@dimen/dimen_sm"
android:paddingLeft="@dimen/dimen_sm"
android:paddingRight="@dimen/dimen_sm"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll">
<LinearLayout
android:id="@+id/top_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingBottom="@dimen/dimen_sm"
android:paddingTop="@dimen/dimen_sm"
app:layout_collapseMode="parallax">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_xs"
app:layout_behavior="string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
現在AppBarLayout在recyclerview開始滾動時開始隱藏。我需要的是
1是可以設置自定義行爲滾動效果? ,我的意思是,當用戶到達RecyclerView中的最後一個項目時,我想開始隱藏AppBarLayout。 (假設如果在回收視圖中有10個項目,則視差效果將在它開始在界面中顯示第10項時開始)
2 - 我可以使用其他佈局而不是AppBarLayout嗎?因爲我有另一個工具欄可用如果我使用AppBarLayout我不得不使用主題,NoActionBar
你能解釋一下嗎? – droidev
從鏈接使用這個自定義類appbar佈局低於https://gist.github.com/skimarxall/863585dcd7abde8f4153 ,並呼籲擴大應用欄或摺疊appBar因此您需要 –