简体   繁体   English

向上/向下滚动显示/隐藏布局

[英]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.

相关问题 如何在Android中向下滚动滚动视图时隐藏和显示布局? - How to hide and show a layout on scrolling down a scroll view in Android? Android向上滚动隐藏视图并向下滚动显示视图效果,如twitter - Android scroll up hide view and scroll down show view effect like twitter 向上滚动时隐藏底部导航 向下滚动时显示 - Hide Bottom Navigation On Scroll Up Show On Scroll Down 折叠工具栏在向上滚动时隐藏,在向下滚动时显示 - Collapsing Toolbar hide when scroll up and show when scroll Down 当我们上下滚动 recyclerView 时隐藏和显示视图组 - Hide and show viewgroup when we scroll up and down the recyclerView 向上滚动时隐藏顶部布局,向下滚动时显示顶部布局(例如collapsingToolbarLayout) - Hide top layout on scrolling up and show on scrolling down (like collapsingToolbarLayout) Android:向下滚动/向上列表视图时,使用动画隐藏RelativeLayout - Android : Hide RelativeLayout with animationwhen scroll down / up listview 在Android中向下运动时显示布局,而在Android中向上运动时隐藏布局 - Display layout on motion down and hide on motion up in android 上下滚动时的Android隐藏和显示操作栏 - Android Hide and Show Actionbar when Scrolling up and down Android:隐藏/显示页脚/页眉为向下/向上滚动scrollview - Android : hide/show footer/header as scrolling scrollview down/up
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM