Android S7E6 :: RecyclerView - CheckBoxes and their States
Автор: ProgrammingWizards TV
Загружено: 2018-05-20
Просмотров: 16337
This is a custom recylcerview with images, text and checkboxes tutorial and example. We see how to handle checkbox states in reccylerview.
SOURCE CODE REFERENCE : http://camposha.info/android-examples...
As you may know recyclerview normally recycles its views. In this case we use cardviews with images and text and checkboxes. So we need to handle the checkboxes states appropriately.
This is a multi-select recyclerview tutorial. You select multiple checkboxes and show the selected items in a Toast message when the Floating Action Button is clicked.
How do you guys, welcome to todays edition of ProgrammingWizards TV.
In this tutorial we will see how to create a custom recyclerview with checkboxes. We then see how to get selected items
from our recyclerview with checkboxes and render them in a Toast message.
and also get the checked items and more importantly
we are going to provide a fix for an earlier
tutorial where we were losing the checkbox state while scrolling.
We are going to make sure we handle this one properly.
so that we handle the checkbox state because as you know
as we scroll through our views, the view are actually getting recycled.
So its actually appropriate for us to be able to handle the state properly
and still get the checked items. So this is what we are going to
look at right here with a RecyclerView. We select items in the RecyclerView and show them in a Toast message.
Join us we get started.
The first thing is to create our application so go type the application name.
Then click next.
Then come chose the API level 14 as minimum sdk.
Then we use the empty activity as our template so select it and click next.Dialogue: 0,0:01:09.00,0:01:13.00,Default,,0,0,0,,And then click finish to generate our android studio project.
Then the next thing is that we come to our gradle scripts.
First we start with our app level build.gradle. We'll have three implementation statements.
The design support, the cardview as well as the app compat.
Then we come add the images we will be showing in our
custom recyclerview with checkboxes.
So we need some images that we are going to render alongside the checkboxes.
So please just make sure you add the images you'll use.
Then we'll come to our layout.
First as a root element we have the relativelayout.
Then a TextView which is our header label.
Then our RecyclerView which will render our checkboxes, images and text.
Then a Floating Action button.
When the FAB or Floating Action Button will be clicked, we will show the
items that will be selected via checkboxes in our RecyclerView in a Toast message.
Then we come to our model.xml layout. This layout will be inflated to a single cardview within our recyclerview.
At the root we have a CardView as the element.
Then we have an imageview and some textviews.
The imageview will render our image, the textviews our text.
We also have a checkbox aligned to the parent right of the cardview.
Users will check the checkboxes in our recyclerview to select a single card.
Let's continue.

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: