[英]Show/hide a layout on scroll up/down android
I am working on an android application and want to implement a functionality in which I want to show a layout which will contain Like/Comment of that content at the bottom of the page. 我正在开发一个Android应用程序,并希望实现一个功能,我想在其中显示一个布局,其中包含页面底部的内容的Like / Comment。 I want this layout to be shown when I scroll up the page and hide when I scroll down the page. 我希望在向上滚动页面时显示此布局,并在向下滚动页面时隐藏。
I have scene many applications that have implemented this feature, but I have no idea how to implement this feature in my app. 我有很多已实现此功能的应用程序,但我不知道如何在我的应用程序中实现此功能。 Please check this link of the app which is giving the same functionality which I want to implenment https://play.google.com/store/apps/details?id=com.midsizemango.materialapps 请检查应用程序的此链接,该链接提供与我要实现的功能相同的https://play.google.com/store/apps/details?id=com.midsizemango.materialapps
Please help if anyone have idea here, Thanks a lot in advanced. 如果有人在这里有想法请帮助,非常感谢先进。
You need to do the same thing which happens with fab, first create a class extending CoordinatorLayout.Behavior<View>
and implement it like other fab examples. 您需要执行与fab相同的操作,首先创建一个扩展CoordinatorLayout.Behavior<View>
的类,并像其他fab实例一样实现它。 just remember that it won't work on simple listView and gridView. 只记得它不适用于简单的listView和gridView。 Also here 'sa good detailed tutorial for you. 这里也是一个很好的详细教程。
You Just have to set Scroll-Up & Scroll-Down listener
of your Recycler view or Scroll View check Reference link . 您只需设置Recycler视图的Scroll-Up & Scroll-Down listener
或Scroll View 检查参考链接 。
Now base on Scroll-Up & Scroll-Down listener set VISIBLE / GONE
of your footer view either it is LinearLayout or Toolbar with animation. 现在,基于Scroll-Up和Scroll-Down监听器设置页脚视图的VISIBLE / GONE
,无论是LinearLayout还是带有动画的工具栏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.