简体   繁体   English

滚动期间仅隐藏AppBar中的底部视图

[英]Hide only bottom view in AppBar during scroll

I want to implement layout, which is similar to the following stub: 我想实现布局,类似于以下存根:

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.appbar.AppBarLayout>

        <View android:id="@+id/firstView"/>

        <View android:id="@+id/secondView"/>

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.recyclerview.widget.RecyclerView />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

And I want to achieve the following behavior: when recycler view scrolls up then only the secondView collapses. 我想实现以下行为:当回收器视图向上滚动时,只有第二个secondView折叠。 Whatever I tried I managed to only hide the firstView on scroll or both. 无论我尝试什么,我设法只隐藏滚动上的第一个firstView或两者。 How can I hide only the second one? 我怎样才能隐藏第二个?

Put the second view out of AppBarLayout. 将第二个视图放在AppBarLayout之外。 Wrap the second view and RecyclerView with LinearLayout and add scroll behavior. 用LinearLayout包装第二个视图和RecyclerView并添加滚动行为。 But the shortcoming is that second view can not scroll. 但缺点是第二种观点无法滚动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM