error: attribute 'com.xyz.abc:itemBackground' not found

error: attribute 'com.xyz.abc:itemBackground' not found

我正在尝试使用 android 底部导航抽屉,但我遇到了一些问题。

这是我项目的 Gradle 文件:

当我将 v28 库与 dexter 一起使用时,我遇到了一些冲突,并且可能与 retrofit 一起使用,因此我添加了这些行:

*implementation 'com.android.support:support-media-compat:28.0.0-rc01'
implementation 'com.android.support:support-v4:28.0.0-rc01'*

{ 排除模块:'appcompat-v7' 排除组:'com.android.support' }

部分。

这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">


    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/colorPrimary"
        app:itemIconTint="@color/accent_white"
        app:itemTextColor="@color/bottom_nav_text"
        app:menu="@menu/bottom_navigation_main" />
</RelativeLayout>

错误说明:未找到属性 itemBackground、itemIconTint、itemTextColor、菜单。请帮我解决这个问题。

一个示例:错误:未找到属性 'com.app.abc.xyz:itemBackground'。 提前致谢。

因为 <android.support.design.widget.BottomNavigationView 已经表明您需要将支持设计库添加到您的依赖项中:

dependencies {
    ...
    implementation 'com.android.support:design:XX.X.X'

}