异常提示:

今天我新创建了一个自定义控件,我为他定义了一个属性为backIcon,但是当我在xml设置这个属性之后,xml布局界面提示以下错误:

错误原因:

在网上查找错误原因的时候,有文章说这是因为我的布局文件的命名空间没有添加有包名的那个命名空间,可是我检查布局文件完毕之后,发现我已经添加了,但是还是报这个异常错误,我的命名空间为:xmlns:myview="http://schemas.android.com/apk/res/com.example.zhufu.view";后来我在另外一篇博文上终于发现了自己的错误原因,这个命名空间后面包名我添加错误了,命名空间后面的包名应该是AndroidManifest.xml文件中定义的package包名,而不是我使用的这个自定义控件所处的包的包名。

解决办法:

解决办法就是将我的布局命名空间改为xmlns:myview=http://schemas.android.com/apk/res/com.example.zhufu"即可,这样就可以使用我的自定义控件了。

参考链接:

http://blog.sina.com.cn/s/blog_6aefcbed01013rpc.html

error: No resource identifier found for attribute ‘backIcon’ in package的更多相关文章

  1. res\menu\main.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.xxx.xxxx'

    res\menu\main.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'co ...

  2. 踩坑实录 使用 cardview 时报错 error: No resource identifier found for attribute 'cardCornerRadius' in package 'com.xxxxx.xxx'

    在项目中引用 cardview 卡片布局,编译时 Android Studio 报出下面图片中红框标记的错误: 出现这种情况的原因在于没有导入 cardview 卡片布局相应的依赖包,因此我们需要在 ...

  3. apktool 回编译报错:No resource identifier found for attribute 'xxxxxx' in package 'android' W:

    C:\xxxx\app-release\res\layout-v26\xxxx.xml:5: error: No resource identifier found for attribute 'xx ...

  4. Android 官网提供的Custom-view 编译出错--error: No resource identifier found for attribute

    error: No resource identifier found for attribute in custom-views from http://developer.android.com ...

  5. Error:(108) No resource identifier found for attribute 'style' in package 'android'

    Error:(108) No resource identifier found for attribute 'style' in package 'android' 解决方案: 这是错误的写法: a ...

  6. No resource identifier found for attribute 'showAsAction' in package 'android'

    运行一个项目时在一个menu.xml文件item属性android:showAsAction 报错 No resource identifier found for attribute 'showAs ...

  7. Error:(12) No resource identifier found for attribute 'titles' in package 'com.itheima52.mobilesafe5

    http://stackoverflow.com/questions/5819369/error-no-resource-identifier-found-for-attribute-adsize-i ...

  8. 自定义view中错误:No resource identifier found for attribute X in package X

  9. Library工程No resource identifier found for attribute

    使用library工程中自定义属性无法识别问题 解决:xmlns:ptr="http://schemas.android.com/apk/res/包名, 改成xmlns:ptr=" ...

随机推荐

  1. View Controller 生命周期的各个方法的用法

    (void)awakeFromNib; 这个方法用的时候,outlet还没有连接起来,是view Controller刚从storyboard建的时候,没有完全建好,不过可能有一些事情要在这个方法里面 ...

  2. Ternary Search Tree Java实现

    /** * @author Edwin Chen * */ //定义节点 class Node { //存储字符串 char storeChar; //是否完成单词 boolean isComplet ...

  3. Brunch:快捷的HTML5构建工具

    Brunch,一个超快的HTML5构建工具.它可以(官方介绍): 编译你的脚本,模板,样式,链接它们, 将脚本和模板封装进common.js/AMD模块里,链接脚本和样式, 为链接文件生成源地图,复制 ...

  4. 跨平台传输中使用base64来保证非ascii码字符串的完整性

    首先,我们来看一个例子: byte[] b=new byte[]{2,9,43}; String ss=new String(b,"utf-8"); byte[] b1=ss.ge ...

  5. Java基础知识强化91:DateFormat类之DateFormat实现日期和字符串的相互转换

    1. DateFormat类概述: DateFormat 是日期/时间格式化子类的抽象类,它以与语言无关的方式格式化并解析日期或时间. 是抽象类,所以使用其子类SimpleDateFormat 2.  ...

  6. ios 中如何应对UIScrollView快速滑动(暴力用户,暴力测试)

    1.实现UIScrollViewDelegate 开始滑动: - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView 滑动 ...

  7. 渲染器 Shader BitmapShader

    渲染模式: tileX tileY:The tiling mode for x/y to draw the bitmap in.   在位图上 X/Y 方向 瓦工/花砖/瓷砖 模式 CLAMP  :如 ...

  8. hdu 2105

    #include <iostream> #include <stdio.h> using namespace std; int main() { double a,b,c,d, ...

  9. sessionstorage,localstorage和cookie之间的区别

    sessionStorage 和 localStorage 是HTML5 Web Storage API 提供的,可以方便的在web请求之间保存数据.有了本地数据,就可以避免数据在浏览器和服务器间不必 ...

  10. CSS中伪类的使用

    原文:http://www.cnblogs.com/guopei/archive/2011/04/16/2017627.html 何为伪类? 也就是实际实现了类的效果,但是并没有实际添加到标签中的类, ...