Here’s what we want to achieve:First let’s create a normal RecyclerView listRecyclerView is an advanced and flexible version of ListView and GridView.
It’s so flexible that the new ViewPager2 class, used to create swipe-able tabs, is written over RecyclerView.
Both inherit the same class so we return the parent class RecyclerView.ViewHolder from onCreateViewHolder().
Hiding the menu when the back button is pressed (in our Activity):@Override public void onBackPressed() { if (adapter.isMenuShown()) { adapter.closeMenu(); } else { super.onBackPressed(); } }3.
If you want to implement a simple swipe to delete function, the code for that can be found here on Github.

Comments to: How to Implement ‘Swipe for Options’ in RecyclerView

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

Login

Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.