Easy cure for develop swipe menu with RecyclerView without any extra libraries — utilizing ItemTouchHelper Callback for swiping products and ItemDecoration for drawing on canvas.

Easy cure for develop swipe menu with RecyclerView without any extra libraries — utilizing ItemTouchHelper Callback for swiping products and ItemDecoration for drawing on canvas.

Rule using this information exists back at my github.

Create RecyclerView software

Very first, let’s produce a tiny program which exhibits some cool information. To work on this, we have to down load some facts eg. from the kaggle.com — let’s install Fifa 2017 participants information ready. It’s plenty of information — 17.6K rows (it will likewise program just how RecyclerView is actually enhanced). Unpack this databases and rescue into assets/players.csv

Before we start to put into action RecyclerView we need to include few dependencies to the task:

Next step will be add format (activity_main.xml) for the MainActivity:

Our software is going to exhibit members facts therefore we want to produce athlete lessons with getter/setter practices:

Adaptor for RecyclerView is an essential class right here. We should instead bypass 3 methods to making points performs:

getItemCount — profits what amount of items we should showcase onCreateViewHolder — brings viewholder and fill the view, it’s merely labeled as once the RecyclerView must create the newer view onBindViewHolder — are joining facts into a viewholder, it is called if the RecyclerView needs to complete correct data into a view

After that, we need to establish quick player_row.xml making use of CardView to display all user facts.

Finaly it’s opportunity for MainActivity course. Inside our example, we review CSV database and go it into an adapter. Continue reading “Easy cure for develop swipe menu with RecyclerView without any extra libraries — utilizing ItemTouchHelper Callback for swiping products and ItemDecoration for drawing on canvas.”