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實現複雜事件檢測
存儲--盤古,阿裏雲飛天分布式存儲係統設計深度解析