此答案解决了示例的第二行,aapt dump在resources.arsc
中定义的值的表示形式。
在您的示例中,包com.android.spare_parts中ID为0x7f04000的资源是一个名为spare_parts的字符串,其值在字符串表中的索引3处定义。
行的格式如下:
resource <resource ID> <package>:<type>/<name> t=<dataType> d=<data> (s=<size> r=<res0>)
resource ID
是您在R.java找到well known ID。
package
就是这个资源被定义的包,并且对于包中的所有资源都是相同的。
type
资源的类型,在资源表别处定义的数量的字符串的一个
name
的资源的名称
data
是资源值,根据的dataType解释(见下文)
size
是值struct的大小(不是值)。似乎永远是0x0008。
res0
是always 0x00。
dataType
是常数之一定义here:
// Contains no data.
TYPE_NULL = 0x00,
// The 'data' holds a ResTable_ref, a reference to another resource
// table entry.
TYPE_REFERENCE = 0x01,
// The 'data' holds an attribute resource identifier.
TYPE_ATTRIBUTE = 0x02,
// The 'data' holds an index into the containing resource table's
// global value string pool.
TYPE_STRING = 0x03,
// The 'data' holds a single-precision floating point number.
TYPE_FLOAT = 0x04,
// The 'data' holds a complex number encoding a dimension value,
// such as "100in".
TYPE_DIMENSION = 0x05,
// The 'data' holds a complex number encoding a fraction of a
// container.
TYPE_FRACTION = 0x06,
// Beginning of integer flavors...
TYPE_FIRST_INT = 0x10,
// The 'data' is a raw integer value of the form n..n.
TYPE_INT_DEC = 0x10,
// The 'data' is a raw integer value of the form 0xn..n.
TYPE_INT_HEX = 0x11,
// The 'data' is either 0 or 1, for input "false" or "true" respectively.
TYPE_INT_BOOLEAN = 0x12,
// Beginning of color integer flavors...
TYPE_FIRST_COLOR_INT = 0x1c,
// The 'data' is a raw integer value of the form #aarrggbb.
TYPE_INT_COLOR_ARGB8 = 0x1c,
// The 'data' is a raw integer value of the form #rrggbb.
TYPE_INT_COLOR_RGB8 = 0x1d,
// The 'data' is a raw integer value of the form #argb.
TYPE_INT_COLOR_ARGB4 = 0x1e,
// The 'data' is a raw integer value of the form #rgb.
TYPE_INT_COLOR_RGB4 = 0x1f,
// ...end of integer flavors.
TYPE_LAST_COLOR_INT = 0x1f,
// ...end of integer flavors.
TYPE_LAST_INT = 0x1f
https://android.googlesource.com/platform/frameworks/base/+/master/tools/aapt/Resource.cpp生成,也许你可以在那里找出它。 – zapl
不是很有帮助,但谢谢! – Ahmad