底部应用栏导航图标不是垂直居中

Nee*_*mar 4 android android-layout android-appbarlayout android-bottomnav bottombar

我正在使用,android.support.design.bottomappbar.BottomAppBar但是添加选项菜单时导航图标位于左上角。

不带Option的情况下,其工作正常(center_vertical)。

带有选项菜单

在此处输入图片说明

没有选项菜单

在此处输入图片说明

谁能告诉我如何解决它?

Mah*_*zad 6

在您的布局中,您可以将BottomAppBar主题更改为此:

<android.support.design.bottomappbar.BottomAppBar
    ...
    android:theme="@style/Widget.MaterialComponents.BottomAppBar"
/>
Run Code Online (Sandbox Code Playgroud)


Nee*_*mar 5

在尝试了不同的方法后,通过样式设置填充有效。

<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>
Run Code Online (Sandbox Code Playgroud)

添加样式后