From the course: Android Development Essential Training: App Architecture with Kotlin

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add a header to a navigation drawer

Add a header to a navigation drawer - Android Tutorial

From the course: Android Development Essential Training: App Architecture with Kotlin

Start my 1-month free trial

Add a header to a navigation drawer

- [Male Instructor] You can add a visual header to the top of a navigation drawer To add the header, first I'm going to need some dimension resources. I'll add these to an existing file in my values directory called dimens.xml. First I'll create a new dimension called header dice margin. And I'll set it to a value of eight DP. Then I'll create a second dimension and this one will be named header dice size and its value will be 30 DP. These will be used to size and lay out a set of image view components that show die images. Next, I'll create a new layout file. A header for a drawer is simply another layout. I'll set the name of the new layout to main nav header and I'll accept the root element of linear layout. You could use a constraint layout to do what I'm about to do, but I'm just going to show an alternative approach. The header's width should be set to match parent. But the height should be set to a specific height. And I'll set it to a value of 176 DP. Next, I'll add some color…

Contents