我正在使用android.support.design.bottomappbar.BottomAppBar
,但添加选项菜单时导航图标出现在左上角。
没有选项它按预期工作(center_vertical)。
带选项菜单
没有选项菜单
任何人都可以告诉如何解决它?
我正在使用android.support.design.bottomappbar.BottomAppBar
,但添加选项菜单时导航图标出现在左上角。
没有选项它按预期工作(center_vertical)。
带选项菜单
没有选项菜单
任何人都可以告诉如何解决它?
在您的布局中,您可以将BottomAppBar 主题更改为:
<android.support.design.bottomappbar.BottomAppBar
...
android:theme="@style/Widget.MaterialComponents.BottomAppBar"
/>
在尝试了不同的方法之后,通过样式设置填充是有效的。
<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>
使用 Google Material 组件时,最好使用Theme.MaterialComponents
主题作为应用程序父主题:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
代替 :
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
在style.xml
我也遇到了同样的问题,但通过添加找到了解决方案:
style="@style/Widget.MaterialComponents.BottomAppBar"
对于底部栏。