Define and implement the ViewHolder class for the header view.
- Now let's switch back to our AlbumGridAdapter.…The final ViewHolder that we will build…is HeaderVeiwHolder.…So let's uncomment this line.…Let's select "HeaderViewHolder"…and look for the lightbulb…and create a new class…and again it will be under the ViewHolders package.…Select that.…So our HeaderViewHolder will also inflate a layout…similar to the other ViewHolders.…
So let's go to "AlbumViewHolder".…And let's select this first line…for inflating the layout.…Copy that with "Command + C".…Go back into our HeaderViewHolder…and paste that in here.…Now instead of inflating a "google_photos_item",…let's select that and replace it…with a new layout called "google_photos_header".…Now let's select the lightbulb…and create a new layout resource file.…
And clean this up a bit again…by putting everything in their own line.…In our HeaderLayoutResource we will define a TextView.…The TextView will be width "match_parent".…And the height "wrap_content".…We will also add an ID…and we will give the ID a name of "label".…We're also going to add a TextSize here.…
- Creating a custom layout with XML
- Setting up OnClick handlers
- Making API calls
- Creating custom views
- Implementing ViewHolder objects
- Signing certificates
- Adding a checkbox
Skill Level Intermediate
Building Android Apps with Cloud Serviceswith Albert Lo2h 37m Intermediate
1. Understanding the Side Navigation Drawer
2. Custom RecyclerView: Multiple View Types
3. Custom RecyclerView: ViewHolders
4. Understanding Custom Views
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.