码迷,mamicode.com
首页 >  
搜索关键字:inflate    ( 358个结果
3.addView调用之后导致子布局的android:layout_width="match_parent"属性或者 android:layout_width="fll_parent"属性无效。
典型错误案例:         经常我们会通过addView方法,动态添加一些子布局,比如下面的一段代码. LinearLayout linParent = (LinearLayout) findViewById(R.id.aty_slider_linParent);View vChild = mInflater.inflate(R.layout.view_loding, null);linP...
分类:移动开发   时间:2014-05-22 09:41:22    阅读次数:553
分析java.lang.NullPointerException thrown in RelativeLayout measure()
不难看出,在RelativeLayout被add/attach到父View之前mLayoutParams成员为空,调用measure方法将导致上图标注处代码抛出空指针异常。 解决方案有两种 a) 在measure之前显式设置LayoutParams(代表着对父View的Layout请求,必须是父View的内部LayoutParams类型) b) 自动设置LayoutParams的inflate方式...
分类:编程语言   时间:2014-05-18 18:26:17    阅读次数:576
LinearLayout详解三:LayoutInflater创建View过程分析
这就是inflate的作用,他就是用来解析xml并显示到屏幕的,至于解析的代码我这边就不多做阐述了,毕竟已经超越了我们的主题太远。我们还是看inflate是如何给解析的xml分配内存,并添加到view上的吧!...
分类:其他好文   时间:2014-05-18 13:57:22    阅读次数:271
29 adapt
public View getView(int position, View convertView, ViewGroup parent) { View view = inflater.inflate(R.layout.gv_item, null); TextView tv = (TextV...
分类:其他好文   时间:2014-05-10 00:41:22    阅读次数:283
获取布局 ActionBar
LayoutInflater inflater = getLayoutInflater();View imageLayout = inflater.inflate(R.layout.preference_image.xml,null);ImageView imageView = (ImageView...
分类:其他好文   时间:2014-05-08 21:34:32    阅读次数:307
Android使用主题属性引发的问题
最近在做一个项目的Porting。直接改变了应用的Theme,最没有仔细的检查。结果应用在某些场景下直接就Crash了。还好,通过Log可以看到是在Inflate某个资源的时候出错导致的。通过定位资源的ID,找到对应的XML文件,发现可疑之处在于ImageView使用了一个主题属性“?xxxAttr...
分类:移动开发   时间:2014-05-07 14:30:26    阅读次数:397
no view for id xxx for fragment错误
用tabhost时,动态添加fragment,从网上找了好多处理结果还是不行。结果是在fragment中   返回的view   View v=inflater.inflate(R.layout.fragment2, container);这个方法需要三个参数才行,添加最后一个参数 View v=inflater.inflate(R.layout.fragment2, container,fals...
分类:其他好文   时间:2014-05-06 19:41:21    阅读次数:293
19 inflate用法
LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);View layout = inflater.inflate(R.layout.main, null);...
分类:其他好文   时间:2014-05-01 13:10:22    阅读次数:310
358条   上一页 1 ... 34 35 36
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!