为何要有res/values/ids.xml(一个res/values/ids.xml引起的血案)

背景介绍:html

想在View上动态的setId,因此须要预先定义好id,以便使用,api上说,能够添加res/values/ids.xml的资源,用于定义公共的id,使用时直接R.id.id_name或android:id="id/id_name"便可。android

结果:api

[2011-08-30 21:06:13 - demo] W/ResourceType(  376): Bad resource table: header size 0xc or total size 0x186b6 is not on an integer boundaryide

[2011-08-30 21:06:13 - demo] W/ResourceType(  376): Bad resource table: header size 0xc or total size 0x186b6 is not on an integer boundarypost

[2011-08-30 21:06:13 - demo] ERROR: Unable to parse generated resources, aborting.ui

缘由:spa

style中有个<item name="android:id">@+id/navigation_bar</item>,这样会致使上面的错误,缘由不知,大概是android在使用了ids.xml后,须要全部的样式中的id都使用已在ids.xml中预先定义好的。xml

可参考下文:http://stackoverflow.com/questions/6009618/android-style-resources-compile-aapt-failing-bad-resource-table-header-sizehtm

android api:http://developer.android.com/guide/topics/resources/more-resources.html资源

相关文章
相关标签/搜索