The method Inflate() in android
来源:互联网 发布:淘宝提升信誉的方法 编辑:程序博客网 时间:2024/06/06 21:38
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
0 0
- The method Inflate() in android
- Android:inflate.inflate()方法
- The method using the Chinese input method in Fedora 16
- android错误:The method makeText(Context, CharSequence, int) in the type
- android开发The method setOnClickListener(View.OnClickListener) in the type View is not错误
- 关于android创建对话框报错The method setPositiveButton(int, DialogInterface.OnClickListener) in the type Alert
- android The method setOnClickListener(View.OnClickListener) in the type View is not applicable for
- android错误:The method makeText(Context, CharSequence, int) in the type
- android错误:The method makeText(Context, CharSequence, int) in the type
- Android Error - The method replace(int, Fragment) in the type FragmentTransaction is not applicable
- android 的The method makeText(Context, CharSequence, int) in the type Toast is not applicable fo(
- android错误:The method makeText(Context, CharSequence, int) in the type
- android错误:The method makeText(Context, CharSequence, int) in the type
- 关于android创建对话框报错The method setPositiveButton(int, DialogInterface.OnClickListener) in the type Alert
- Android Inflate
- Android inflate
- Steps in the Emergency Performance Method
- The method of parameters given in Python
- java.lang.ClassCastException
- [C/C++]使用上下左右控制菜单项
- 葡萄奶酥
- dojo小例子(15)给dojo on的事件处理函数传递自定义参数的两种方法
- 插入排序
- The method Inflate() in android
- 关于:小米唐沐:十年经验 做产品32字方针的摘录
- [PhoneGap] [Cordova] 生成Jar文件
- 利用java模拟登陆
- Spring3.0官网文档学习笔记(六)--3.4.1
- 在已有win7系统下安装ubuntu遇到的一些问题
- Socket网络编程
- hdu1238
- C++课程设计----ATM机