简体   繁体   English

当用户滚动时,如何从“滑动显示” RecyclerView菜单项中隐藏底部布局?

[英]How to hide bottom layout from Swipe-to-reveal RecyclerView menu item when user scrolls?

I am using this class (there is a lot of code, so I won't post it here) to implement Swipe-to-reveal action, and when user swipes from right to left on any CardView item in RecyclerView, bottom layout is shown with some buttons. 我正在使用此类 (有很多代码,因此我不会在此处发布)来实现“滑动到显示”操作,当用户在RecyclerView中的任何CardView项目上从右向左滑动时,将显示底部布局与一些按钮。 When user swipes from left to right, bottom layout is hidden: 当用户从左向右滑动时,底部布局被隐藏:

在此处输入图片说明

Everything works great, but I want to achieve effect which allow users to automatically hide bottom layout with extra buttons when they scroll. 一切都很好,但我想实现这样的效果:允许用户在滚动时自动隐藏带有额外按钮的底部布局。 There are methods named open() and close() in the class above, and I am trying to call them in onDown() method: 上面的类中有一些名为open()close()的方法,我试图在onDown()方法中调用它们:

 mDragHelper.smoothSlideViewTo(mMainView, mRectMainClose.left, mRectMainClose.top);

but I'm getting this error: 但我收到此错误:

  • Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference 尝试在空对象引用上调用虚拟方法'int android.view.View.getLeft()'

Found this very awesome library named SwipeRevealLayout from chthai64. 从chthai64找到了一个非常棒的名为SwipeRevealLayout的库

Maybe someone will find this useful, I did! 也许有人会发现这个有用,我做到了!

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

相关问题 当 recyclerview 滚动时折叠/隐藏特定布局 - Collapse/hide a specific layout when recyclerview scrolls 更改列表项布局时 RecyclerView 滚动到顶部 - When changing list item layout RecyclerView scrolls to top 当用户滚动到RecyclerView的底部时,使用ScrollListener从Firebase Realtime DB中提取数据 - Issue using ScrollListener to pull data from Firebase Realtime DB when user scrolls to the bottom of a RecyclerView 从底部滑动出现导航栏时如何隐藏BottomNavigationView? - How to hide BottomNavigationView when navigation bar appears by swipe from bottom? 使用contentproviders时如何在recyclerview中滑动项目 - how to swipe item in recyclerview when using contentproviders 当 RecyclerView 不在第一个项目上时,如何禁用滑动刷新布局? - How can i disable swipe refresh layout when RecyclerView is not on the first item? 加载数据时 RecyclerView 滚动到底部 - RecyclerView scrolls to bottom when data is loaded 使用 ItemTouchHelper 拖动项目时 RecyclerView 滚动到顶部 - RecyclerView scrolls to top when dragging item with ItemTouchHelper 展开项目时,RecyclerView向下滚动 - RecyclerView scrolls down when expanding item 长按recyclerview项目后如何在底部导航中显示菜单 - How to show a menu in bottom nav after long click on recyclerview item
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM