一个res/values/ids.xml引发的血案

背景介绍:

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

结果:

[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 boundary

[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 boundary

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

原因:

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

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

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

posted on 2011-08-30 21:13  还有什么  阅读(4794)  评论(0编辑  收藏  举报

导航