inflate, findViewById与setContentView的区别与联系
来源:互联网 发布:可可网络验证eno破解 编辑:程序博客网 时间:2024/04/30 13:17
protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_news_content);viewFlipperNewsUi = (ViewFlipper) findViewById(R.id.viewflipper_news_ui); inflater = getLayoutInflater();View rLNewsUi = inflater.inflate(R.layout.news_body, null);viewFlipperNewsUi.addView(rLNewsUi);}
1、inflate是用来找layout下布局文件,并实例化;而findViewById是找布局文件下的具体widget。
2、setContentView()一旦调用, layout就会立刻显示UI;而inflate只会把Layout形成一个以view类实现成的对象,有需要时再用setContentView(view)显示出来。
1 0
- inflate, findViewById与setContentView的区别与联系
- inflate, findViewById与setContentView的区别与联系
- inflate, findViewById与setContentView的区别与联系
- 有关Fragment的getActivity().findViewById,以及inflate与 findViewById 区别、setContentView和inflate的区别!!!
- findViewById()与Inflate()和setContentView()关系扯谈
- findViewById()与Inflate()和setContentView()关系扯谈
- inflate与setcontentview及findviewbyid(一)
- inflate与setcontentview及findviewbyid(二)
- setContentView和inflate调用findViewById的区别
- setContentView、findViewById 和 inflate 的区别?
- setContentView、findViewById 和 inflate 的区别?
- inflate方法与findViewById的区别
- inflate方法与findViewById的区别
- inflate 方法与 findViewById方法的区别
- inflate方法与getViewByID和setContentView的区别
- Android inflate方法与 findViewById 方法区别
- inflate与findViewById
- setContentView()与findViewById()的书写顺序
- nginx的十一个阶段处理
- 数据结构 之 priority_queue 优先队列
- java生成可执行文件方法及关于图片正确显示的问题
- 失眠经验
- grep 搜索时忽略 .git目录
- inflate, findViewById与setContentView的区别与联系
- Linux下查找文件详解
- JAVA向上转型与向下转型
- Asp.net与office web apps的整合
- item32: 确定你的public继承塑造出is-a关系
- 值传递与引用传递1
- c#主窗口获取对话框的某一控件的值
- 九度oj 题目1114:神奇的口袋
- 详解Java中的Pattern和Matcher