简体   繁体   English

错误未找到与给定名称匹配的资源:Android Studio中的attr'borderWidth'

[英]Error No resource found that matches the given name: attr 'borderWidth' in Android Studio

First of all I would like to clarify that a lot about this has been written, I've read some posts but the common things they say I have them done. 首先,我想澄清的是,有关此方面的文章很多,我读了一些帖子,但是他们说我已经完成了一些常见的事情。 Download the latest Support Library version, Support repository version, etc. Also I'm compiling against the latest available SDK version. 下载最新的支持库版本,支持存储库版本等。另外,我正在根据最新的可用SDK版本进行编译。 My problem is when adding styles for the Floating Action Button and when adding for example app:layout_behavior for the RecyclerView. 我的问题是为“浮动操作按钮”添加样式时,以及为RecyclerView添加例如app:layout_behavior时。 That causes me the same kind of problems. 那给我造成了同样的问题。 Actually I'm trying to introduce the Material design in an older app. 实际上,我正在尝试在较旧的应用程序中介绍Material设计。 With the new ones I have no problems, but I've checked and the configuration is the same. 有了新的,我没有问题,但是我检查了一下,配置是一样的。 Am I missing something? 我想念什么吗?

Here is my current configuration. 这是我当前的配置。

在此处输入图片说明

Module build.grade: 模块build.grade:

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.xxx"
        minSdkVersion 16
        targetSdkVersion 23
        // Enabling multidex support.
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    lintOptions {
        disable 'MissingTranslation'
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.google.android.gms:play-services-plus:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
}

Top level build.gradle: 顶级build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Here are the styles causing me problems with borderWidth, pressedTranslationZ and rippleColor: 这是导致我的borderWidth,PressedTranslationZ和波纹颜色问题的样式:

<style name="FabStyle">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_margin">@dimen/fab_compat_margin</item>
    <item name="android:src">@drawable/ic_action_add</item>
    <item name="borderWidth">0dp</item>
    <item name="elevation">6dp</item>
    <item name="pressedTranslationZ">12dp</item>
    <item name="rippleColor">@android:color/white</item>
</style>

Here is my layout. 这是我的布局。 If I remove the Floating Action Button along with its styles, then the problem is with the layout_behaviour of the RecyclerView. 如果删除浮动操作按钮及其样式,则问题出在RecyclerView的layout_behaviour。

<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="com.egane.BaseCustomersActivityActivity">

    <android.support.v4.widget.DrawerLayout
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CoordinatorLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <android.support.v7.widget.RecyclerView
                android:id="@android:id/list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

            <android.support.design.widget.AppBarLayout
                android:id="@+id/appBarLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:background="?attr/colorPrimary"
                    app:layout_scrollFlags="scroll|enterAlways"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

            </android.support.design.widget.AppBarLayout>

            <android.support.design.widget.FloatingActionButton
                android:id="@+id/fab"
                style="@style/FabStyle"
                android:layout_gravity="bottom|end"/>

        </android.support.design.widget.CoordinatorLayout>

        <android.support.design.widget.NavigationView
            android:id="@+id/navigation_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            app:headerLayout="@layout/drawer_header"
            app:menu="@menu/drawer"/>

    </android.support.v4.widget.DrawerLayout>

</RelativeLayout>

Thanks in advance! 提前致谢!

根据Android开发者文档 ,“浮动操作”按钮属于android.support.design.widget.FloatingActionButton,这意味着您应添加

compile 'com.android.support:design:23+'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio - 错误:找不到与给定名称匹配的资源:attr&#39;metaButtonBarButtonStyle&#39; - Android Studio - Error: No resource found that matches the given name: attr 'metaButtonBarButtonStyle' Android Studio:未找到与给定名称匹配的资源:attr&#39;android:actionModeShareDrawable&#39; - Android Studio : No resource found that matches the given name: attr 'android:actionModeShareDrawable' Android Studio:找不到与给定名称匹配的资源:attr&#39;searchViewTextField&#39; - Android Studio: No resource found that matches the given name: attr 'searchViewTextField' 错误:找不到与给定名称匹配的资源:attr&#39;fabSize&#39;:attr&#39;rippleColor&#39; - Error: No resource found that matches the given name: attr 'fabSize': attr 'rippleColor' Android错误:找不到与Android Studio中的给定名称匹配的资源 - Android Error: No resource found that matches the given name in Android Studio 错误:错误:找不到与给定名称匹配的资源:attr&#39;colorAccent&#39; - error: Error: No resource found that matches the given name: attr 'colorAccent' 找不到与给定名称匹配的资源:attr&#39;android:elevation&#39; - No resource found that matches the given name: attr 'android:elevation' 找不到与给定名称匹配的资源:attr&#39;android:windowTranslucentNavigation&#39; - No resource found that matches the given name: attr 'android:windowTranslucentNavigation' 找不到与给定名称匹配的资源:attr&#39;android:keyboardNavigationCluster&#39; - No resource found that matches the given name: attr 'android:keyboardNavigationCluster' 找不到与给定名称匹配的资源:attr&#39;android:keyboardNavigationCluster&#39; - No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM