Android   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了java – 没有为包中的属性’layout_behavior’找到资源标识符大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我的应用程序工作正常,直到我尝试添加库.添加库后,Android studio会出现以下错误

这是我的build.gradle文件

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.ogaclejapan.smarttablayout:utils-v4:1.3.0@aar'
    compile 'com.ogaclejapan.smarttablayout:library:1.3.0@aar'
    compile 'com.jpardogo.materialtabStrip:library:1.1.0'
    // compile 'com.lorentzos.swipecards:library:1.0.9@aar'
    compile 'com.android.support:cardview-v7:21.0.3'
    compile 'com.android.support:recyclerview-v7:21.0.3'
    compile 'com.melnykov:floaTingactionbutton:1.3.0'
    compile project(':swipelib')
}

这是导致错误的xml:

 <android.support.v4.view.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layouT_Behavior="@String/appbar_scrolling_view_behavior"/>

我尝试了以下方法

>删除了库
>重置Android studio和我的电脑
>从git恢复到以前版本的代码.

但是,错误仍然存​​在.我该如何解决这个问题?

解决方法:

该字符串资源在Material Design支持库中定义.

由于您未使用Material Design支持库中的CoordinatorLayout,因此您应该能够安全地删除app:layouT_Behavior属性.它可能被削减了&从其他代码粘贴.

注意:如果您实际使用的是CoordinatorLayout并希望协作滚动行为起作用,则需要将最新版本的Material Design Support库的依赖项添加到Gradle构建文件中:

compile 'com.android.support:design:23.0.1'

更新:请注意,对于最新版本的Gradle,不推荐使用编译配置以支持实现和api配置,因此您的依赖关系可能如下所示:

implementation 'com.android.support:design:27.0.2'

这只是一个例子;阅读本文时,版本号可能已过期,因此请确保您的版本与您要使用的支持库版本相匹配.

欲了解更多信息:What’s the difference between implementation and compile in gradle

大佬总结

以上是大佬教程为你收集整理的java – 没有为包中的属性’layout_behavior’找到资源标识符全部内容,希望文章能够帮你解决java – 没有为包中的属性’layout_behavior’找到资源标识符所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: