我不能使用 labelVisibilityMode

-2 dependencies android bottomnavigationview

即使我已经添加了依赖项设计,我也不明白为什么会发生这种情况?

我的错误

我的错误..

我的依赖

我的来源

我尝试这样做,但有些东西显示出另一个错误

小智 5

尝试使用新的 material.io 2.0 和 androidx.. 试试这个代码..

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">

<include
    android:id="@+id/amToolbar"
    layout="@layout/app_toolbar"
    />

<FrameLayout
    android:id="@+id/activity_main_container"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    app:layout_constraintTop_toBottomOf="@+id/amToolbar"
    app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
     />

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:labelVisibilityMode="labeled"
    app:layout_constraintBottom_toBottomOf="parent"
    app:menu="@menu/bottom_menu" />

 </androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

请参阅此链接 https://material.io/design/components/bottom-navigation.html