关于Android的资源id
2024-10-06 14:30:07
1 @+id/xx
这个表示向资源文件中添加一个新的id。
@+id是在R文件中生成int xxx=value。
有两种情况
①R文件中不存在xxx变量,则生成int xxx=value即为控件新建一个id值
②若R文件中已存在xxx变量,则不再新建,直接引用该变量对应的id值
2 @id/xxx
引用现有的资源。
例子:
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/textView1" //请看这一行
android:text="@string/textview2" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textview1" />
2 @android:id/list
只是在使用ListView的时候才规定要用@android:id/list
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
最新文章
- MVC 后台管理框架 FineUIMvc 在线示例
- DAC Usage4:从 Backup Package(.bacpac)还原DB
- SpringBoot list查询方法
- ajax提交Form
- extjs,清空treepanel数据。
- node.js 初体验
- js运动 模仿淘宝幻灯
- IDS 日志分析
- net开发过程中Bin目录net开发过程中Bin目录下面几种文件
- php中奖算法逻辑
- Linux安装解压缩版jdk
- Hive命令及操作
- RHEL系统初始化步骤
- 更新pip和setuptools
- 洛谷P2347 砝码称重 【多重背包】(方案数)(经典)
- 【CF884D】Boxes And Balls k叉哈夫曼树
- linux-centos6-rabbitmq安装及配置
- 学习Struts框架系列(三):声明式异常处理
- VS2010 单元测试,性能测试 案例
- 几种流行的开源WebService框架Axis1,Axis2,Xfire,CXF,JWS比较
热门文章
- Java中堆内存和栈内存有什么区别
- Python学习日记(十)—— 杂货铺(全局变量补充、Python参数传递、字符串格式化、迭代器、生成器)
- UVALive 5052 Genome Evolution ——(xjbg)
- php-fpm(绕过open_basedir,结合ssrf)
- Jenkins与gitlib实现自动化部署与持续构建
- Nginx 之 Location 的整理
- 转载---WCF、WPF、Silverlight和区别
- Flutter实现TabBarView切换页面时每个页面只initState一次
- delphi10.3.1不支持.net 5
- nginx - nginx下配置thinkphp5