I using THIS LIBRARY for this tutorial. Take a look at the following steps.
PREPARATION
Compile this library to your build.gradle (Module :app) :
Prepare 2 layouts and give name like below :
- activity_main.xml
- swipe_layout.xml
Prepare 4 java class and give like below :
- MainActivity.java
- StudentModel.java
- DividetItemDecoration.java
- SwipeRecyclerViewAdapter.java
IMPLEMENTATION
1. Prepare all XML file that we'll use in this project
Create a divider layout in your Drawable folder, give name as divider.xml. Paste the code below :
Divider.xml used as the border line of recyclerview's item.
Modify your color.xml or you can use the default color when the project created
Modify your style.xml, paste the code below :
Modify your activity_main.xml, paste the code below :
Modify your swipe_layout.xml, paste the code below :
2. Prepare all the Java class
Modify your StudentModel.java like below :
After that, Modify your DividerItemDecoration.java until look like the following code :
Next, write down the following code in your SwipeRecyclerViewAdapter.java. Here the code :
Last, modify your MainActivity.java until similar like the following code :
That's all the steps for swiping on RecyclerView's item. Wait for other Tutorial.
BELOW IS THE COMPLETE PROJECT LINK : LINK GITHUB
1 komentar so far
Great Article
Android Final Year Project Ideas for Computer Science
Project Centers in Chennai
EmoticonEmoticon