Build and test your custom view.
- [Narrator] I have a couple comments that I wanted to share about composite views. The Google Photos Viewholder, that you see on the right here, started out as a composite view. I have included Google Photos Item View, class, in the exercise files. So let's bring that up by opening our project view. And we go under views, and we select Google Photos Item View. Let's bring that up into the other window. And I'll close my project window.
So, Google Photos Item View shares some similarities with Google Photos Viewholder. As you can tell, the Google Photos Viewholder constructor will inflate a layout. And we do that in InitViews as well. There's a set data method, and if we go to Google Photos Item View, there's also set data method and an onclick handler. I wound up going with Google Photos Viewholder with the structure as you see, because it was more consistent with the other Viewholders, like the Album Viewholder and the Header Viewholder.
However, I am leaving Google Photos Item View in the Exercise file to serve as an example of what a composite view looks like. Google Photo Item View has all the elements of your typical composite view. It extends a container, which in this case, will be the relative layout, here. And it inflates its own view, which is here. And it contains child views, which is "thumbnail" and "checkBox," in our case.
So I would encourage you to explore some more about composite views by trying this out and including it into the app.
- 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.