602
京东网上商城
The method Inflate() in android
Inflate() method can find out a layout defined by xml,as like the findViewById() method,but there have some different between them.
The different are:
If your Activity used other layout,such as the dialog layout,and you want to set the component's content in that layout.you must use the inflate() method to find it out,then use the findViewById() method to find other components above it.such as:
View view1=View.inflate(this,R.layout.dialog_layout,null); TextViewdialogTV=(TextView)view1.findViewById(R.id.dialog_tv); dialogTV.setText("abcd");
note:R.id.dialog_tv is in dialog layout,if you direct to use the this.findViewById(R.id.diaog_tv),it will throw error.
View viewStub = ((ViewStub) findViewById(R.id.stubView)).inflate();
you can imagine it as "hidden inflation",hide placed in view,before inflate() just to find the control,but no size and didn't occupy place in the view.
after inflate(),it must have size,but hide.
if you also interest in linux and android embed system,please connection with us in QQ grounp:139761394
最后更新:2017-04-03 07:57:13
上一篇:
DiscrollView--ScrollView滚动时的控件动画效果 GIT项目
下一篇:
计算几何概述
???????????????Elasticsearch????????????2????????????2.4.3???????????????-??????-????????????-?????????
《Docker容器:利用Kubernetes、Flannel、Cockpit和Atomic构建和部署》——导读
堆排序
软文推广新闻发稿现在都是怎么收费的?有没有好的新闻推广平台?
高性能网络编程6–reactor反应堆与定时器管理
String源码简析
C# 网络编程之网页自动登录 (一).使用WebBrower控件模仿登录
第一个Hello world(1)
基于阿里云MaxCompute实现复杂事件检测
存储--盘古,阿里云飞天分布式存储系统设计深度解析