Skip to content Skip to sidebar Skip to footer

Adding Two AppCompat Toolbars With Different Themes

I would like to have two different android.support.v7.widget.Toolbars in my app, one dark, one light, and switch between them when needed. However, when I set a different theme on

Solution 1:

Make a ContextThemeWrapper:

ContextThemeWrapper wrapper = new ContextThemeWrapper(context, R.style.Some_Theme);

Use the current Context to inflate one toolbar and use the ContextThemeWrapper to inflate the other. Use getLayoutInflater() to get the inflater for each context.


Post a Comment for "Adding Two AppCompat Toolbars With Different Themes"