Header View
This is a view for NavigationView in android.support.design library
Import
At the moment the library is in my personal maven repo
How to use
Via XML
Create a layout named like this header_drawer.xml
And in your NavigationView
Manage Profiles
The new HeaderView manage different profile and a new profile chooser inspired from YouTube android app
- Create a profile
- Add a profile
- Set a profile active
- Remove a profile
- Get actual active profile
Customize Profile Chooser
You can also customize the profile chooser
- Add bottom items
- HighlightColor in dialog
headerView.setHighlightColor(ContextCompat.getColor(this, R.color.colorAccent));
app:hv_highlight_color="@color/colorAccent"
- Change dialog title
headerView.setDialogTitle("Choose account");
app:hv_dialog_title="Dialog title"
- Change dialog top icon
headerView.setAddIconDrawable(R.drawable.ic_action_settings);
app:hv_add_icon="@drawable/ic_action_settings"
- Or hide dialog top icon
headerView.setShowAddButton(true);
app:hv_show_add_button="true"
- Dismiss profile chooser dialog
Callback
Loading image from network
Just add this in your class Application (of course you can use your preferred libs for load images)
Use custom font with Calligraphy
You can set a custom font with Calligraphy just add a CustomViewTypeface with HeaderView.class in CalligraphyConfig