错误:找不到属性“ com.xyz.abc:itemBackground”

时间:2018-08-31 11:26:43

标签: android android-layout android-studio android-gradle gradle-plugin

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

这是我的项目的Gradle文件:

enter image description here

当我与dexter一起使用v28库并可能进行了翻新时,我遇到了一些冲突,因此我添加了以下几行:

*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'。  预先感谢。

1 个答案:

答案 0 :(得分:1)

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

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

}