framework添加资源
来源:互联网 发布:淘宝怎样才有极速退款 编辑:程序博客网 时间:2024/06/15 19:11
有时候我们想在标准的Framework中添加自己的新的资源怎么办呢?
办法就是我们来尝试下。
通过Eclipse的联系,我们可以联想到是否就是简单的把字符串放在res的各个文件夹里面。先来试试看,编译,系统立即报错。为什么呢?
它提示你利用make update-api这个命令来更新public.xml文件或者把这个声明称hide类型。这个肯定不是我们想要的。
所以方法有二:
方法1:正常添加完资源后,执行make update-api函数。系统更新res/values/public.xml文件。
方法2:正常添加完资源后,手动更改/res/values/public.xml文件。打开public.xml文件。发现结构如下:
- <resources>
- <!-- We don't want to publish private symbols in Android.R as part of the
- SDK. Instead, put them here. -->
- <private-symbols package="com.android.internal" />
- <!-- AndroidManifest.xml attributes. -->
- <eat-comment />
- <!-- ===============================================================
- Resources for version 1 of the platform.
- =============================================================== -->
- <eat-comment />
- <public type="string" name="cancel" id="0x01040000" />
- <public type="string" name="copy" id="0x01040001" />
- <public type="string" name="copyUrl" id="0x01040002" />
- <public type="style" name="TextAppearance.Widget.TextView.SpinnerItem" id="0x01030052" />
- <public type="style" name="TextAppearance.WindowTitle" id="0x01030053" />
- <public type="attr" name="theme" id="0x01010000" />
- <public type="attr" name="label" id="0x01010001" />
- <public type="attr" name="icon" id="0x01010002" />
- <public type="attr" name="name" id="0x01010003" />
- <public type="attr" name="manageSpaceActivity" id="0x01010004" />
- <public type="attr" name="allowClearUserData" id="0x01010005" />
- <public type="attr" name="permission" id="0x01010006" />
- <public type="attr" name="readPermission" id="0x01010007" />
- <public type="attr" name="writePermission" id="0x01010008" />
- <public type="attr" name="protectionLevel" id="0x01010009" />
- <!-- ===============================================================
- Resources added in version 7 of the platform (Eclair MR1).
- =============================================================== -->
- <eat-comment />
- <public type="attr" name="author" id="0x010102b4" />
- <public type="attr" name="autoStart" id="0x010102b5" />
- </resources>
这样,我们可以自己动手添加。
推荐方法1,也是最标准的做法。为啥?
1:避免id重复。
2:麻烦
3:习惯标准化做法。
- framework添加资源
- framework中添加资源!!!!!!!!!
- 添加资源到frameWork层
- android framework中添加资源文件
- android framework中添加私有资源文件
- 在framework中添加字符串资源
- android framework中添加私有资源文件
- 添加资源到android framework层
- Framework 资源添加时问题整理
- android Framework层添加资源方式
- 在framework中添加字符串资源
- Framework中添加并引用资源
- framework下添加资源文件方法
- 在framework中添加字符串资源
- android 往 Framework中添加新的资源
- 添加资源到android源码中-修改framework层
- 添加资源到android源码中-修改framework层
- Android 往 Framework中添加新的资源
- VIM命令大全
- 将OpenStack私有云部署到Hadoop MapReduce环境
- 大流量网站的底层系统架构
- python threading多线程控制和处理
- CIRCOS教程翻译 1.1——helloworld
- framework添加资源
- c语言枚举类型详解
- 线上系统问题的紧急处理案例(一)
- pyro介绍
- Cognos下载地址
- 如何用div+css制作横向菜单
- mysql常用处理数据方法,更新中。。。。
- 记录解决WINCE下一次内存泄漏的情况
- Linux中link,unlink,close,fclose详解