可以肯定的一点,那些静态变量的int值确实是代表内存地址。
个人认为:由于R.java是根据main.xml自动创建的,所以,那些组件应该是在创建main.xml时被放到那些内在地址中的。
个人认为:由于R.java是根据main.xml自动创建的,所以,那些组件应该是在创建main.xml时被放到那些内在地址中的。
解决方案 »
- 怎麼讓Android手機上的Sim卡工具包顯示出來?
- 急!!BaseAdapter onKeyDown
- 请问:如何实现Button的位置移动
- android中如何创建自己的收件箱
- 使用droiddraw,应该把图片放在哪个目录才能显示图片啊?
- *** 请教,android怎么获得正在运行程序的程序名和图标??? ***
- 问andorid关于动画的问题
- android fragment点击返回键实现内容切换?
- RecyclerView+ViewPager的实现问题
- java.lang.NoSuchFieldError: No field INSTANCE of type Lorg/apache/http/conn/ssl/
- 两个关于Android的界面操作问题
- android上计时的方法是什么啊
大家认为呢,用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类