LayoutInflater
来源:互联网 发布:如何用淘宝买东西 编辑:程序博客网 时间:2024/05/16 08:22
LayoutInflater这个类它的作用类似于findViewById()。不同点是LayoutInflater是用 来找res/layout/下的xml布局文件,并且实例化;而findViewById()是找xml布局文件下的具体widget控件(如 Button、TextView等)。
具体作用:
1、对于一个没有被载入或者想要动态载入的界面,都需要使用LayoutInflater.inflate()来载入;
2、对于一个已经载入的界面,就可以使用Activiyt.findViewById()方法来获得其中的界面元素。
LayoutInflater 是一个抽象类
inflater()接收三个参数,其中第三个参数的含义是:
是否把选取的视图加入到root中。false 的意思就是不添加到root中。可能需要我们手动添加。
1 0
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- angular创建自定义的指令
- Python针对特定服务定制的代理工具V2.1-------(简述与2.0的区别之处)
- U-boot目录简介
- 编写测试用例及一个例子
- 集合框架-List集合-3
- LayoutInflater
- Jsp 获取访问者IP地址
- Python 通过连接qq邮箱服务器发送邮件
- 【JZOJ5077】【GDOI2017第三轮模拟day2】树的难题
- HDOJ--2043 密码
- 深度学习之减少过拟合的可能性
- 嵌入式开发之路
- 水平垂直居中处理,总有你想要的
- HDU 1114 Piggy-Bank 解题报告(完全背包)