Join Albert Lo for an in-depth discussion in this video Understand layout XML custom parameters, part of Android Development: Modern Android UI Design Elements.
- [Voiceover] To get started with customizing the navigation drawer layout, we need to open the layout XML file. In Android Studio, let's go to app, resources, layout, and select activity_main. I'm going to use Command + 1 to minimize the android view. The activity_main layout contains three major components. First one is the DrawerLayout, which is the container for the side navigation drawer itself.
Then, there is also app_bar_main, which is included as a child of DrawerLayout. And finally, we also have NavigationView. Notice that the NavigationView has two fields with the prefix app. First one is headerLayout, and then also there's menu. These two app fields effectively act as an input parameter for the custom view named NavigationView. It also allows the developer to pass in data or other information into the view, much like how we can call Java methods with input parameters.
In particular, if we go to NavigationView, and we can do that by hovering over navigation view and selecting Command + B. Then we search, using Command + F, we search for inflateMenu. We will see the Navigation_menu Resource Id. Now what happens here, is that the Android framework takes the name of the Android menu item that was defined in the field app:menu, in activity_main, and it will concatenate that with the name of the class to define the Resource Id.
This is a standard procedure when dealing with reading custom parameters from layout XML files. The Android menu items do not always give us the level of control we need over the UI of the navigation drawer items. The next step will be to customize the navigation drawer by going the activity_main layout XML file.
- 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.