`

res与res-auto的区别——AndroidStudio自定义属性xmlns无法识别问题

 
阅读更多

res与res-auto的区别

通常我们在布局文件中使用自定义属性的时候
会这样写

xmlns:app="http://schemas.android.com/apk/res/包路径"

但如果你当前工程是做为lib使用,那么你如上所写 ,会出现找不到自定义属性的错误 。
这时候你就可以 写成

xmlns:app="http://schemas.android.com/apk/res-auto"

 

摘自: http://blog.csdn.net/altair86/article/details/34438989

 

问题来源:

eclipse导出为 generate gradle build files后

在项目中使用自定义属性报错

xmlns:cascade="http://schemas.android.com/apk/res/com..."

Multiple annotations found at this line:

- When using a custom namespace attribute in a library project, use the namespace "http://schemas.android.com/apk/res-auto" 

instead.

 

- Unused namespace cascade

解决:

删除导出时的所有生成文件和文件夹

 

而在AnroidStudio 中使用自定义属性xmlns的时候

正如in Gradle projects,always usehttp://schemas.android.com/apk/res-auto for custom attributes所说的

 

将eclipse中    http://schemas.android.com/apk/res/com.xxx.xxx  

换成   http://schemas.android.com/apk/res-auto 

 

摘自: http://blog.csdn.net/nwsuafer/article/details/42121521

分享到:
评论

相关推荐

    Android Studio 创建自定义控件的方法

    我们知道,当系统控件并不能满足我们的需求时,我们就需要来创建自定义控件,主要有两种方法 (1)引入布局 下面来自定义一个控件,iPhone的...LinearLayout xmlns:android=http://schemas.android.com/apk/res/android

    Android代码-自定义圆形拖动条

    xmlns:swagpoints="http://schemas.android.com/apk/res-auto" android:id="@ id/seekbar_point" android:layout_width="match_parent" android:layout_height="340dp" android:layout_gravity="center" ...

    Android自定义SeekBar滑动显示数字

    <merge xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools> <RelativeLayout android:id=@+id/wrapper_seekbar_indicator android:la

    Android代码-VerificationCodeView

    VerificationCodeView 一、添加依赖 Android Studio:在项目...在布局中集成,注意需要在布局的根节点添加命名xmlns:zhangym="http://schemas.android.com/apk/res-auto" 方可使用自定义属性。 对应属性说明如下:

    Android 使用mediaplayer播放res/raw文件夹中的音乐的实例

    Android 使用mediaplayer播放res/raw文件夹中的音乐的实例 (1)在res文件夹中新建一个文件夹重命名为raw,并且将要播放的音乐放到raw文件夹里面 (2)修改layout目录下的xml布局文件,添加3个按钮空间和一个文本...

    Android Studio连接SQLite数据库的登录注册实现

    1、先看一下项目目录: 2、新建一个AS项目,创建如上图所示的目录结构,然后添加内容: (1)修改添加布局文件: ... xmlns:app=http://schemas.android.com/apk/res-auto xmlns:tools=http://

    Android代码-AndroidGradientUI

    xmlns:app="http://schemas.android.com/apk/res-auto" Then you can add GradientIconView in layout.xml The GradientIconView can gradient change itself from top_icon to bottom_icon. GradientIconView will...

    Android Studio实现简易计算器

    如果是制作简易计算器的话是基本没有难点的,供大家参考,具体内容如下 步骤是先写好界面布局,将按钮的布局、字号颜色啥的做好,再就是设置监听器。... xmlns:app=http://schemas.android.com/apk/res-auto xmlns:

    Android代码-个人中心页面框架

    xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@ id/item_one" android:layout_width="match_parent" android:layout_height="wrap_content" leon:leftIcon="@drawable/history" leon:...

    Android编程使用自定义shape实现shadow阴影效果的方法

    本文实例讲述了Android编程使用自定义shape实现shadow阴影效果的方法。分享给大家供大家参考,具体如下: 直接上xml文件, 并且附上相应的解析: <?xml version=1.0 encoding=utf-8?> <selector xmlns:android...

    Android studio实现加法软件

    本文实例为大家分享了Android studio实现加法软件的具体代码,供大家参考,具体内容... xmlns:app=http://schemas.android.com/apk/res-auto xmlns:tools=http://schemas.android.com/tools android:layout_width=

    Android studio listview实现列表数据显示 数据循环显示效果

    Android studio listview实现列表数据显示 样式不好看!想要好看的样式可以私我,我加! item.xml <?xml version=1.0 encoding=utf-8?> <!--item --> <LinearLayout xmlns:android=...

    Android studio设计简易计算器

    本文实例为大家分享了Android studio设计简易计算器的具体代码,供大家参考,具体内容如下 效果显示: 第一步,简单的界面布局 <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=...

    Android Studio实现简单计算器APP

    一、简介:用Android Studio 实现一个简单的计算器APP,并在蓝叠模拟器中运行。 该计算器只能实现两位数字的四则运算。 二、代码 activity_main.xml —界面设计 <?xml version=1.0 encoding=utf-8?> <...

    Android 自定义Button控件实现按钮点击变色

    效果图如下所示: ...<selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_pressed=true> <shape android:shape=rectangle> <solid android:color=#73c4f3> <

    Adaptive-Icons-Help:在Android O中使用Googles新的自适应图标的说明

    步骤1-在android studio中创建一个针对Android O预览的项目如果您已经有一个项目,则可以跳过此步骤第2步-将mipmap-anydpi和mipmap文件夹添加到项目的/ app / src / main / res /文件夹中步骤3-在/ app / src / main...

    Android-PullToNextLayout:Android-PullToNextLayout

    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=".MainActi

    Android Studio实现简单购物车功能

    本文实例为大家分享了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=

    Android实训购物车页面

    -<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...

Global site tag (gtag.js) - Google Analytics