找回密码
 立即注册
skinmainericprojectthe | android开发 2022-10-29 53 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
皮肤也就是相关的资源文件独自放置在某个工程中,一种皮肤一个工程文件.一个工程包括N多的资源文件,多个工程间资源的联系是,文件名,资源ID等完全一样.在实现程序功能的一起,如果能让程序界面愈加漂亮,有锦上添花之妙.先说思路:1)皮肤也就是相关的资源文件独自放置在某个工程中,一种皮肤一个工程文件.一个工程包括N多的资源文件,多个工程间资源的联系是,文件名,资源ID等完全一样.不同的可能是图片资源,style等的设置不同.2)皮肤工程在AndroidManifest.xml中配置android:sharedUserId=com.eric.skinmain.表明许可com.eric.skinmain访问本工程中的资源文件.eric.skinmain是主项意图包名3)主项目通过this.createPackageContext(com.eric.blackskin,Context.CONTEXT_IGNORE_SECURITY);获取到com.eric.blackskin对应的Context,然后通过回来的context对象就可以访问到com.eric.blackskin中的任何资源,好像访问本身的资源一样.
SkinMain\gen\com\eric\skinmain\R.java
SkinMain\res\drawable\bg.xml
SkinMain\res\drawable\btn_normal.xml
SkinMain\res\drawable\icon.png
SkinMain\res\layout\main.xml
SkinMain\res\values\strings.xml
SkinMain\src\com\eric\skinmain\main.java
SkinMain\.classpath
SkinMain\.project
SkinMain\AndroidManifest.xml
SkinMain\default.properties
.....

(Skin means that the related resource files are placed in a project independently, one skin and one project file A project includes more than N resource files. The connection of resources among multiple projects is that the file name, resource ID, etc. are exactly the same. When implementing program functions, if you can make the program interface more beautiful, it will be wonderful Let's start with the following ideas: 1) Skin means that the related resource files are placed in a project independently, one skin for one project file A project includes more than N resource files. The connection of resources among multiple projects is that the file name, resource ID, etc. are identical. The difference may be image resources, The settings of style, etc. are different. 2) The skin project configures android in AndroidManifest.xml: sharedUserId=com. eric.skinmain. It indicates that com. eric.skinmain is allowed to access the resource file in the project. eric.skinmain is the main item intent package name. 3) The main project passes this. createPackageContext (com. eric.backskin, Context. CONTEXT_IGNORE_SECURITY); Get the Context corresponding to com. eric.backskin, and then access any resources in com. eric.backskin through the returned context object, as if you were accessing your own resources
SkinMain\gen\com\eric\skinmain\R.java
SkinMain\res\drawable\bg.xml
SkinMain\res\drawable\btn_ normal.xml
SkinMain\res\drawable\icon.png
SkinMain\res\layout\main.xml
SkinMain\res\values\strings.xml
SkinMain\src\com\eric\skinmain\main.java
SkinMain\.classpath
SkinMain\.project
SkinMain\AndroidManifest.xml
SkinMain\default.properties
.....)

[下载]15504897669.rar




上一篇:使用DOM解析XML文件——构建实时地震信息列表
下一篇:获取Android系统程序信息