今天反编译了某个应用,再一次的发现了,ids.xml和public.xml文件。之前有了解过相关的知识,但是仅限于一下某些“似是”的了解,这样挺危险的,故写下这段文字来做一个深入研究的第一步。
1、粗浅的认知:
使用ids.xml可能带来的好处,"@id"比"@+id"的编译速度要快,因为只要在R.java生成一次对应值之后,便不会再次生成;最大的好处可能还是支持public.xml
What is the use of the res/values/public.xml file on Android?
1、粗浅的认知:
使用ids.xml可能带来的好处,"@id"比"@+id"的编译速度要快,因为只要在R.java生成一次对应值之后,便不会再次生成;最大的好处可能还是支持public.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="profiles_qqweibo_v_icon" />
<item type="id" name="navbar_layout">false</item>
</resources>使用public.xml可能带来的好处,可以控制生成资源文件的"唯一标识",可能使换肤类功能更易实现,或者另一方面可支持一个项目使用多工程分模块开发的形式? 弊端则是太麻烦。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<public type="attr" name="adapterViewBackground" id="0x7f010000" />
<public type="string" name="follow_err_limited" id="0x7f0c00e4" />
<public type="style" name="PapaPreferenceTheme" id="0x7f0d0015" />
<public type="color" name="pull_to_refresh_text_color" id="0x7f08000a" />
<public type="id" name="viewpager_layout" id="0x7f07012a" />
</resources>2、可参考:
What is the use of the res/values/public.xml file on Android?
Difference between “@id/” and “@+id/” in Android
本文探讨了Android开发中ids.xml与public.xml的作用及优缺点。ids.xml通过减少R.java重复生成提升编译效率,而public.xml则允许开发者自定义资源ID,便于换肤功能实现及多模块开发。
1013

被折叠的 条评论
为什么被折叠?



