5

I'm using android.support.design.bottomappbar.BottomAppBar but the navigation icon is coming in left top corner when option menu is added.

without Option its working as expected (center_vertical).

With option menu

enter image description here

Without Option Menu

enter image description here

Can any one tell how to fix it?

Mahozad
  • 18,032
  • 13
  • 118
  • 133
Neeraj Kumar
  • 111
  • 1
  • 8

4 Answers4

7

In your layout, you can change the BottomAppBar theme to this:

<android.support.design.bottomappbar.BottomAppBar
    ...
    android:theme="@style/Widget.MaterialComponents.BottomAppBar"
/>
Mahozad
  • 18,032
  • 13
  • 118
  • 133
5

After trying different ways, setting padding through styles worked.

<style name="NavButtonPadding" parent="@android:style/Widget.ActionButton">
    <item name="android:paddingStart">10dp</item>
    <item name="android:paddingEnd">10dp</item>
    <item name="android:minWidth">10dp</item>
</style>

After Adding styles

Neeraj Kumar
  • 111
  • 1
  • 8
2

It's better to use Theme.MaterialComponents themes as application parent theme when you use Google Material components:

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">

instead of :

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

in style.xml

0

I have also got the same issue, but found a solution by adding:

style="@style/Widget.MaterialComponents.BottomAppBar"

for bottomBar.

Zoe
  • 27,060
  • 21
  • 118
  • 148