关于android xml文件中 android:id="@+id/my_button"的含义疑问
2011-10-13 20:59
633 查看
许多UI开发的同学会对 android:id="@+id/my_button"的含义有所疑问,细心的同学会发现官方SDK是这样解释的,
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource. The plus-symbol (+) means that this is a new resource name that must be created and added
to our resources (in the
must add the
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
意思也就是说 @符号要通知xml要转换@后面的字符串为ID资源,而+号表示这是要创建一个新的资源名字,并且添加到R.java文件中。
当你要引用已有的资源的时候 可以直接写成 @android:id/empty
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource. The plus-symbol (+) means that this is a new resource name that must be created and added
to our resources (in the
R.javafile). There are a number of other ID resources that are offered by the Android framework. When referencing an Android resource ID, you do not need the plus-symbol, but
must add the
androidpackage namespace, like so:
android:id="@android:id/empty"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
意思也就是说 @符号要通知xml要转换@后面的字符串为ID资源,而+号表示这是要创建一个新的资源名字,并且添加到R.java文件中。
当你要引用已有的资源的时候 可以直接写成 @android:id/empty
相关文章推荐
- android xml文件中 android:id="@+id/my_button"的含义
- 关于:android:layout_height associated with an element type "Button"错误
- 关于xml命名空间的——xmlns:f="http://www.name.com.cn/sub",一些疑问
- 关于android:id="@+id/xx"的理解
- Hibernate实体类映射文件demo.hbm.xml 中的<generator class="?"></generator>的不同属性含义
- 在androidMainfest.xml文件中在此Activity中写入 android:windowSoftInputMode="adjustPan" 可以让界面不被弹出的键盘挤上去。
- 在androidMainfest.xml文件中在此Activity中写入 android:windowSoftInputMode="adjustPan" 可以让界面不被弹出的键盘挤上去。
- android R文件Syntax error on token "int", VariableDeclaratorId expected after this token
- android .xml 文件 tools:context="activity name"
- Android中使用AlertDialog,使用函数setButton()出现的关于“new OnClickListener"错误
- 关于VC++6.0添加文件就出现“microsoft developer studio已停止工作"的解决办法
- Android xml资源文件中@、@an…
- android中用xml文件设置button的各个状态的图片。
- 64位Ubuntu配置android环境报错(...adb&quot;: error=2, 没有那个文件或目录)
- Android xml资源文件中@、@android:type、@*、?、@+含义和区别
- Android xml资源文件中@、@android:type、@*、?、@+含义和区别
- 关于android中的” unable to instantiate activity componentinfo"的错误
- 【android】在xml文件中定义drawable数组、id数组等
- 设置了布局文件android:onClick="back" 但点击反应
- @+id/android:list"和"@android:id/list"的写法