之前总是莫名其妙地遇到过这种问题,在网上找了不少解决方案,但是还是不知道要怎么解决。求大神告诉原理以及到底要怎么解决的??????

No resource identifier found for attribute

No resouse identifer found for attribute ‘layout_constraintHorizontal_chainStyle’

No resource identifier found for attribute

原因:使用的​​1.0.8-alpha​​​版本的源码里根本没有​​Chain​​相关属性的支持,

No resource identifier found for attribute

把alpha7改成compile 'com.android.support.constraint:constraint-layout:1.0.2

在这里附上之前搜集到的解决方案

解决方式:这是我在网上找到的最多的解决方案。

错误原因:

布局文件的命名空间没有添加有包名的命名空间或者添加了错误的命名空间。

解决办法:

命名空间后面的包名应该是AndroidManifest.xml文件中定义的package包名,而不是自定义控件所处的包的包名。

例如:


xmlns:ptr="http://schemas.android.com/apk/res/com.ycii.ljapp.ui",
  com.ycii.ljapp.ui为AndroidManifest.xml 中定义的 package,
  即:
  <manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ycii.ljapp.ui"
    android:versionCode="1"
    android:versionName="1.0" >


解决要点:要解决这类问题,最主要的是先判断有没有导入所用的包,有的时候是因为没有对应的依赖才出现这样的问题


No resource identifier found for attribute

 



错误环境2:在使用databinding自定义BindingAdapter出现No resource identifier found for attribute 'XXX' in package XXXXX'问题

@BindingAdapter(value = "is_set_animation")
public static void setAnimation(AdapterViewFlipper view, Boolean isTrue) {
if(isTrue){
view.setInAnimation(view.getContext(),R.anim.left_in);
view.setOutAnimation(view.getContext(),R.anim.left_out);
}

}

xml代码:


<AdapterViewFlipper
android:layout_width="@dimen/px560"
android:layout_height="@dimen/px710"
android:flipInterval="5000"
android:autoStart="true"
bind:itemView="@{fragmentModel.itemView}"
bind:items="@{fragmentModel.home_HomeImgList}"
bind:on_item_click="@{fragmentModel.HomeImgItemClickListener}"
bind:is_set_animation="true"
>
</AdapterViewFlipper>


错误原因:没有使用databinding的语法

解决方法:


将bind:is_set_animation="true"改成bind:is_set_animation="@{true}"就可以了