怎么可能是内存地址!!!! 程序运行前你还能知道资源文件所在的内存地址。荒谬!!! 官方解释是: A project's R.java file is an index into all the resources defined in the file. You use this class in your source code as a sort of short-hand way to refer to resources you've included in your project. This is particularly powerful with the code-completion features of IDEs like Eclipse because it lets you quickly and interactively locate the specific reference you're looking for.The important thing to notice for now is the inner class named "layout", and its member field "main". The Eclipse plugin noticed that you added a new XML layout file and then regenerated this R.java file. As you add other resources to your projects you'll see R.java change to keep up.
可以肯定这个不是内存地址。请参考一下《HelloAndroid》一书: The hex numbers are just integers that the Android resource manager uses to load the real data, the strings, and the other assets that are compiled into your package. You don’t need to worry about their values. Just keep in mind that they are handles that refer to the data, not the objects that contain the data. Those objects won’t be inflated until they are needed. Note that almost every Android program, including the base Android framework itself, has an R class. 翻译一下(翻译的不好,别喷我:) ): 这个16进制的数字仅仅是个整数,Android的资源管理器用它来加载编译到你包里的实际的数据、字符串、其他assets,你不用担心他们的值,只要记住他们是涉及到数据的句柄,而不是包含数据的对象。这些对象知道被使用时才会被放到填充(我自己不太理解这句话,可能是:知道用到时才被加载到内存中)。注意:几乎每个Android程序,包括最基本的Android框架也有一个R类
大家认为呢,用HashMap存资源信息
官方解释是:
A project's R.java file is an index into all the resources defined in the file.
You use this class in your source code as a sort of short-hand way to refer to
resources you've included in your project. This is particularly powerful with the
code-completion features of IDEs like Eclipse because it lets you quickly and
interactively locate the specific reference you're looking for.The important thing to notice for now is the inner class named "layout", and
its member field "main". The Eclipse plugin noticed that you added a new XML
layout file and then regenerated this R.java file. As you add other resources to
your projects you'll see R.java change to keep up.
The hex numbers are just integers that the Android resource manager
uses to load the real data, the strings, and the other assets that are
compiled into your package. You don’t need to worry about their values.
Just keep in mind that they are handles that refer to the data, not the
objects that contain the data. Those objects won’t be inflated until they
are needed. Note that almost every Android program, including the base
Android framework itself, has an R class.
翻译一下(翻译的不好,别喷我:) ):
这个16进制的数字仅仅是个整数,Android的资源管理器用它来加载编译到你包里的实际的数据、字符串、其他assets,你不用担心他们的值,只要记住他们是涉及到数据的句柄,而不是包含数据的对象。这些对象知道被使用时才会被放到填充(我自己不太理解这句话,可能是:知道用到时才被加载到内存中)。注意:几乎每个Android程序,包括最基本的Android框架也有一个R类