如果在Activity中用到了别的Layout ,比如对话框等,你还要使用对话框中的组件,如TextView等,必须要先加载布局,然后才能使用里面的控件, 如 : View view = View.inflate(this,R.layout.dialog,null); TextVi...
分类:
移动开发 时间:
2015-02-26 11:34:37
阅读次数:
144
android里很多时候需要在弹出的AlertDialog里有自己的控件,填写信息,比如弹出一个登陆对话框那么首先你就要创建这么一个布局的inputphonenum.xml文件了 接下来你就要在AlertDialog里引用这个布局了首先要提取这个xml文件,这就用到了下面这个inflate()...
分类:
移动开发 时间:
2015-02-10 09:13:28
阅读次数:
157
作用:
1、对于一个没有被载入或者想要动态载入的界面, 都需要使用inflate来载入.
2、对于一个已经载入的Activity, 就可以使用实现了这个Activiyt的的findViewById方法来获得其中的界面元素.
方法:
Android里面想要创建一个画面的时候, 初学一般都是新建一个类, 继承Activity基类, 然后在onCreate里面使用setCo...
分类:
其他好文 时间:
2015-02-07 09:10:44
阅读次数:
125
Dia dialog ; public void go(View view){ dialog = (Dia) getLayoutInflater().inflate(R.layout.main, null); LayoutParams param = new LayoutParams(Layo...
分类:
其他好文 时间:
2015-02-07 06:47:47
阅读次数:
206
今天学了popuWindow,获益匪浅,所以来分享一下。//加载布局ViewcontentView=View.inflate(getApplicationContext(),R.layout.popu_dialog,null);//找到相应的控件进行操作1,拨打电话,2,发送短信LinearLayoutll_call=(LinearLayout)contentView.findViewById(R.id.ll_call);Lin..
Android 自定义toast 宽高大小 背景图片
RelativeLayout layout = (RelativeLayout) getLayoutInflater().inflate(R.layout.layout_custom_toast,null);
((TextView) layout.findViewById(R.id.tvCheckoutWay)).s...
分类:
移动开发 时间:
2015-02-04 18:45:06
阅读次数:
161
首先,新建一个继承了fragment类的类,在oncreateview方法中,使用方法的参数inflater,用其inflater.inflate(R.layout.fragment1,container,false);来新建一个view并在此方法中返回该VIEW,这就是我们的fragment的界面...
分类:
其他好文 时间:
2015-02-03 22:37:10
阅读次数:
156
publicViewgetView(intposition,ViewconvertView,ViewGroupparent){ViewconvertView:启动时出现的值缓存在(View)convertView中 //如果当前为空,则加载布局 Viewview; if(cenvertView==null){ view=View.inflate(getApplicationContext(),R.layout.lv_item,null); } //如..
分类:
移动开发 时间:
2015-02-03 07:09:35
阅读次数:
190
LayoutInflater概述
从XML文件中实例化一个布局成对应的View类, 它从来不会直接使用, 而是使用getLayoutInflater()或者getSystemService(String)来获得一个对应当前context的标准LayoutInflater 实例。
例如:
1
2
3
LayoutInfl...
分类:
移动开发 时间:
2015-02-02 18:04:55
阅读次数:
286
错误打印部分代码:
android.view.InflateException: Binary XML file line #8: Error inflating class
02-02 11:43:11.420: E/AndroidRuntime(25333): at android.view.LayoutInflater.createView(LayoutInflater.java...
分类:
移动开发 时间:
2015-02-02 14:18:18
阅读次数:
174