【问题标题】:Weird behaviour using MaterialComponents and BottomNavigationView. Android使用 MaterialComponents 和 BottomNavigationView 的奇怪行为。安卓
【发布时间】:2023-04-01 17:15:02
【问题描述】:

我正在使用材料设计库中的 BottomNavigationView,一切似乎都很好。

我需要使用新的badges,所以我已将其升级到版本 'com.google.android.material:material:1.1.0'

但我不知道为什么更改版本会在我的底部导航视图中绘制成倒三角形。在黑色背景中很难看到它。但它就在那里,我不知道为什么,但升级后我的所有设备都会发生这种情况。

这是我的 BottomNavView xml

  <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigationView"
        style="@style/MainBottomMenu"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:itemIconSize="@dimen/bottom_nav_icon_size"
        app:labelVisibilityMode="labeled"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/bottom_nav_menu" />


 <style name="MainBottomMenu">
        <item name="android:background">@color/gray_25t</item>
        <item name="itemIconTint">@drawable/nav_item_color_state_light</item>
        <item name="itemTextColor">@drawable/nav_item_color_state_light</item>
        <item name="android:paddingTop">@dimen/padding_nano</item>
    </style>

感谢您的帮助。

【问题讨论】:

  • 第一步尝试使用稳定版 1.1.0 而不是 1.1.0-alpha09。
  • 1.1.0版本也是这样。
  • 能否分享一下您在 中写的内容,否则请尝试添加 app:itemBackground="@drawable/with_custom_selector"
  • 我已经更新了这个问题。我也添加了 itemBackground 但没有任何反应

标签: android material-design android-bottomnavigationview


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-25
    相关资源
    最近更新 更多