开发者

How to assign the resource id in android?

How to assign the resource id in android? I use aapt dump resources to browser a normal application resource:

Package Groups (1)
Package Group 0 id=127 packageCount=1 name=com.android.picker
  Package 0 id=127 name=com.android.picker typeCount=5
    type 0 configCount=0 entryCount=0
    type 1 configCount=1 entryCount=7
      spec resource 0x7f020000 com.android.picker:drawable/btn_normal: flags=0x00000000
      spec resource 0x7f020001 com.android.picker:drawable/icon: flags=0x00000000
      spec resource 0x7f020002 com.android.picker:drawable/icon1: flags=0x00000000
.......

From the above message, I can found the resource id start with 127(0x7f).And I browser another application resouce:

Package Groups (1)
Package Group 0 id=2 packageCount=1 name=com.android.pinkskin
  Package 0 id=2 name=com.android.pinkskin typeCount=6
    type 0 configCount=0 entryCount=0
    type 1 configCount=1 entryCount=7
      spec resource 0x02020000 com.android.pinkskin:drawable/btn_default: flags=0x00000000
      spec resource 0x02020001 com.android.pinkskin:drawable/btn_default_normal: flags=0x00000000
      spec resource 0x02020002 com.android.pinkskin:drawable/btn_default_normal_disable: flags=0x00000000
      spec resource 0x02020003 com.android.pinkskin:drawable/btn_default_normal_disable_focused: flags=0x00000000
.........

The difference between the two applications is their make file: The com.android.picker make file is:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := Picker


include $(BUILD_PACKAGE)

and the make file of com.android.pinkskin application is:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := PiknSkin
LOCAL_AAPT_FLAGS := -x

LOCAL_EXPORT_PACKAGE_RESOURCES := true

include $(BUILD_PACKAGE)

I found Android resource id always have a package identifier, so their value cannot be 0. – Rom开发者_如何学Cain Guy. Who can explain this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜