MaterialToolbar vs Toolbar

Asked on August 30, 2023
What is difference between and androidx.appcompat.widget.Toolbar?

When should we use MaterialToolbar and when should we use Toolbar?

Replied on August 30, 2023
1. MaterialToolbar class is created using Toolbar

public class MaterialToolbar extends Toolbar {

2. MaterialToolbar implements certain material features such as elevation overlays for Dark Themes and centred titles.

3. For the dark theme elevation overlays, we can use Material AppBarLayout with child Toolbar with no background.

4. AppBarLayout can contain MaterialToolbar with transparent background.

Write Answer

©2024 | Privacy Policy | Contact Us