2013-08-20 32 views
2

aapt的输出格式是什么?Android aapt输出格式

例如检查这里输出http://elinux.org/Android_aapt

配置0 LANG = - CNT = - 广州澳凌= 0触摸= 0密度= DEF键= 0 INFL = 0 NAV = 0 W = 0 H = 0 SZ = 0 LNG = 0

资源0x7f040000 com.android.spare_parts:XML/spare_parts:T = 0×03 = d 0x00000003(S = 0×0008,R = 0×00)

什么每个字段意思?有没有任何文件或什么?

+0

https://android.googlesource.com/platform/frameworks/base/+/master/tools/aapt/Resource.cpp生成,也许你可以在那里找出它。 – zapl

+0

不是很有帮助,但谢谢! – Ahmad

回答

0

此答案解决了示例的第二行,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。

res0always 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