【问题标题】:error: attribute 'com.xyz.abc:itemBackground' not found错误:找不到属性“com.xyz.abc:itemBackground”
【发布时间】:2019-02-06 10:17:05
【问题描述】:

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

这是我项目的 Gradle 文件:

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

*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”。 提前致谢。

【问题讨论】:

  • 您需要以 TEXT 而不是 IMAGE 的身份分享您的布局和错误
  • 我希望问题的最后一行说明了这一点!

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


【解决方案1】:

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

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

}

【讨论】:

  • 谢谢。我在处理其他 gradle 问题时不小心删除了该行。
猜你喜欢
  • 2019-03-08
  • 2014-06-24
  • 1970-01-01
  • 2020-08-25
  • 2013-02-07
  • 2018-06-13
  • 2021-04-09
  • 2021-12-11
  • 2020-11-22
相关资源
最近更新 更多