@+id/和android:id有什么区别?
Any View object may have an integer ID associated with it, to uniquely identify the View within the tree. When the application is compiled, this ID is referenced as an integer, but the ID is typically assigned in the layout XML file as a string, in the id attribute. This is an XML attribute common to all View objects (defined by the View class) and you will use it very often. The syntax for an ID, inside an XML tag is:
android:id="@+id/my_button"
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"
android:id="@+id/btn",表示在R.java文件里面新增一个id为btn的控件索引,最常用的一种声明控件id的方式。android:id="@android:id/tabhost",表示引用的是系统已有的ID,在对应的sdk目录下的ids.xml里面。一般外部不去调用,是组件内部调用的时候使用。.android:id="@id/btn" ,表示引用一个已经存在的ID,在R.java里面的,比如我们自己建了一个ids.xml,里面声明了一组id,其中一个是btn,那么你就可以这样引用了。
@+id/和android:id有什么区别?的更多相关文章
- @+id/和android:id的区别
android:id="@+id/btn",表示在R.java文件里面新增一个id为btn的控件索引,最常用的一种声明控件id的方式.android:id="@andro ...
- android:id="@+id/button1" 与 android:id="@id/button1" 区别 @string
一.android:id="@+id/button1" 与 android:id="@id/button1" 区别 android:id="@+id/ ...
- Android @id和@+id区别
Android中的组件需要用一个int类型的id属性值来表示.id属性只能接受资源类型的值,也就是必须以@开头的值,例如,@id/abc.@+id/xyz等.如果在@后面使用“+”,表示当修改完某个布 ...
- 深入理解android:id以及@+id/name和@id/name的区别联系
今天为了好好研究了下@+id/name和@id/name的区别以及联系,又翻了翻文档/guide/topics/resources/layout-resource.html中关于 android:id ...
- android:id="@id/resid" , andorid:id="@+id/resid" 的区别
的区别?android:id="@id/resid" // 引用现有的资源idandorid:id="@+id/resid" // 新增一个资源id i ...
- Android @+id与@id的区别
Android中的组件需要用一个int类型的值来表示,这个值也就是组件标签中的id属性值.id属性只能接受资源类型的值,也就是必须以@开头的值,例如,@id/abc.@+id/xyz等. 如果在@ ...
- android:id="@android:id/tabhost" 、android:id="@+id/llRoot" 、android:id="@id/llRoot" 之间的区别
由于快要放暑假了,所以最近这俩周把Android方面的知识复习一下,准备找个实习工作. 顺便把自己的总结更大家分享一下,共同进步,谢谢.... 一. android:id="@android ...
- android:id 中区别。。
一. android:id="@android:id/tabhost" 是调用系统内部的ID 和代码中 mTabContent = (FrameLayout) findView ...
- Failed to apply plugin [id 'com.android.application'] 和 Could not find com.android.tools.build:gradle:2.XX的最正确的解决方法
发现android studio是真的可爱啊,上一秒还没问题可以build运行,下一秒就出错...好,你任性,你牛逼.. 说下今天又遇到的两个问题:Failed to apply plugin [id ...
随机推荐
- applet jre冲突问题
erp中用到applet,jre为1.6,开发用到jdk1.8,有冲突 安装jre1.6,再安装jdk8,将jdk1.8文件夹复制后卸载1.8,然后重新黏贴,将javahome定向到1.8文件夹
- Struts2框架下的文件上传文件类型、名称约定
Struts2框架下的文件上传机制:1.通过multipart/form-data form提交文件到服务器2.文件名是通过什么地方设置的?在strust2的FileUploadInterceptor ...
- MySQL--(了解)可能会用到的内置函数
mysql内置函数列表可以从mysql官方文档查询,这里仅分类简单介绍一些可能会用到的函数.1 数学函数abs(x)pi()mod(x,y)sqrt(x)ceil(x)或者ceiling(x)rand ...
- 帮你彻底搞懂JS中的prototype、__proto__与constructor(图解)
作为一名前端工程师,必须搞懂JS中的prototype.__proto__与constructor属性,相信很多初学者对这些属性存在许多困惑,容易把它们混淆,本文旨在帮助大家理清它们之间的关系并彻底搞 ...
- springmvc框架原理分析和简单入门程序
一.什么是springmvc? 我们知道三层架构的思想,并且如果你知道ssh的话,就会更加透彻的理解这个思想,struts2在web层,spring在中间控制,hibernate在dao层与数据库打交 ...
- Hive学习01-基础常见问题
理论: 什么是hive: 1. Hive旨在实现轻松的数据汇总,即时查询和分析大量数据. 2. 它提供了SQL,使用户可以轻松地进行临时查询,汇总和数据分析. 3. Hive可以使用用户定义函数( ...
- mybatis 按in 函数参数顺序排序
使用 FIELD()函数 SELECT * FROM user WHERE id IN (72, 80, 69) ORDER BY FIELD(id, 72, 80, 69)
- swift 实践- 08 -- UISegmentedControl
import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoa ...
- restful中的分页
普通分页 普通分页类似于Django中的分页 源码 class PageNumberPagination(BasePagination): """ A simple pa ...
- ModuleNotFoundError: No module named 'requests'
1.问题描述 DOS 执行 .py 脚本报错: ModuleNotFoundError: No module named 'requests' ModuleNotFoundError: No modu ...