Android Library Project自定义控件属性无法找到说明
2014-03-01 14:41
423 查看
在使用Android Library Project的时候,使用了自定义控件,命名空间我们通常会使用包名作为后缀
http://schemas.android.com/apk/com.custom.pkg, 然而子工程引用的时候却一直报错无法找到某某控件属性,查阅资料后发现,如果在Library Project里使用自定义控件的话,必须使用如下的命名空间 xmlns:custom="
http://schemas.android.com/apk/res-auto ",custom名字可以任取。以下是来自Google group上的讨论,在SDK release not应该也能看到。
It was closed because it was actually solved. Take a look into "what's new in sdk r17": Added support for custom views with custom attributes in libraries. Layouts using custom attributes must use the namespace URI http://schemas.android.com/apk/res-auto instead of the URI that includes the app package name. This URI is replaced with the app specific one at build time.
这里也做了说明,为什必须要用res-auto,原因是build的时候会将它体会为包名http://stackoverflow.com/questions/4461407/help-with-a-custom-view-attributes-inside-a-android-library-project/10217752#10217752
相关文章推荐
- AndroidManifest.xml中application name功能介绍
- android下消息机制简介
- 性能优化之布局优化
- android中对图片进行处理时内存溢出,程序崩溃
- Android开发者必知的开发资源
- Android学习笔记TableLayout布局
- Android开发者必知的开发资源
- android Uri获取真实路径转换成File的方法
- Android开源项目发现--- 工具类Log篇(持续更新)
- Android开源项目发现--- 工具类Log篇(持续更新)
- Android开源项目发现--- 工具类文件处理篇(持续更新)
- Android开源项目发现--- 工具类文件处理篇(持续更新)
- Android开源项目发现--- 工具类向下兼容篇(持续更新)
- Android开源项目发现--- 工具类向下兼容篇(持续更新)
- Android、IOS 获取剪切板内容
- Android开源项目发现--- 工具类快速开发篇(持续更新)
- Android开源项目发现--- 工具类快速开发篇(持续更新)
- Android4.4 新增沉浸模式
- android-sdk\platform-tools\adb.exe' and can be executed.
- Android开源项目发现--- 工具类数据库ORM篇(持续更新)