许多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 R.java file). 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 android package namespace, like so:

android:id="@android:id/empty"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------


    意思也就是说 @符号要通知xml要转换@后面的字符串为ID资源,而+号表示这是要创建一个新的资源名字,并且添加到R.java文件中。

    当你要引用已有的资源的时候 可以直接写成 @android:id/empty

更多相关文章

  1. Android应用程序资源管理器
  2. [置顶] Android应用程序资源管理器
  3. [置顶] Android(安卓)开发资源
  4. Android(安卓)xml资源文件中@、@android:type、@*、?、@+引用写法
  5. 关于android的id
  6. android找不到图片资源
  7. ANDROID url资源站
  8. API 23 inputmethodservice.KeyboardView——属性分析
  9. Android程序员必备精品资源

随机推荐

  1. JS 字面量的简化,推荐使用
  2. 参数过多的压缩例子
  3. docker 安装 oracle
  4. 使用PS软件将图片背景变成透明
  5. Mysql触发器
  6. 绑定事件练习、组件练习、路由练习
  7. JS: 使用模板字面量作为参数的函数
  8. Android(安卓)开发笔记 动画效果 --Anima
  9. Android弹出软键盘布局是否上移问题
  10. android 属性android:visibility