Inflate () method can find out a layout defined by xml,as like the Findviewbyid () Method,but There has some different betw Een them.
The different are:
If your Activity used other Layout,such as the dialog Layout,and your want to set the component's content in that Layout.yo U must use the inflate () method to find it out,then with the Findviewbyid () method to find other components above It.such a S
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'll 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 did N ' t occupy place in the view.
After inflate (), it must has size,but hide.
If you also interest on Linux and Android embed system,please connection with us in QQ grounp:139761394