一般用LayoutInflater做一件事:inflateinflate这个方法总共有四种形式(见下面),目的都是把xml表述的layout转化为View对象。其中有一个比较常用,View inflate(int resource, ViewGroup root),另三个,其实目的和这个差不多。in...
分类:
其他好文 时间:
2015-12-28 10:18:30
阅读次数:
154
假设你不关心其内部实现,仅仅看怎样使用的话,直接看这篇就可以。接上篇,接下来,就用最最简单的样例来说明一下:用两个布局文件main 和 test:当中,main.xml文件为: test.xml文件为: 在test中设置了其高度为200dp,而且设置了背景颜色。接下来看一下LayoutI...
分类:
移动开发 时间:
2015-12-20 19:09:46
阅读次数:
247
透明背景对话框 AlertDialog.Builder mBuilder = new AlertDialog.Builder(this, R.style.full_screen_dialog);
View view = LayoutInflater.from(this).inflate(R.layout.item_list, null);
mBuilde...
分类:
其他好文 时间:
2015-12-14 16:47:45
阅读次数:
200
一开始想把他们分成一件件来做01背包(是在下输了),然后发现直接来一个完全背包就可以了(严重打击自信心),然后再来一个大牛的实用优化(但貌似我写得很拙),看来我还是太年轻了。 1 /* 2 ID:abc31261 3 LANG:C++ 4 TASK:inflate 5 */ 6 #includ...
分类:
其他好文 时间:
2015-12-01 00:12:24
阅读次数:
182
LayoutInflater作用是将layout的xml布局文件实例化为View类对象。获取LayoutInflater的方法有如下三种:LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_I...
分类:
其他好文 时间:
2015-11-29 10:43:22
阅读次数:
163
view = LayoutInflater.from(getActivity()).inflate( R.layout.dialog_tips, null); title2 = (TextView) view.findViewById(R.id.title2); d...
分类:
移动开发 时间:
2015-11-17 13:02:15
阅读次数:
208
LayoutInflater大家很熟悉,简单点说就是布局文件XML解析器,setContentView函数也是调用了LayoutInflater 用法: View view = LayoutInflater.from(this).inflate(R.layout.activity_main, nul...
分类:
移动开发 时间:
2015-11-13 14:41:32
阅读次数:
344
问题:自定义AlertDialog出现黑边运行代码段:View view = View.inflate(context, R.layout.dialog_common, null);mDialog = new AlertDialog.Builder(context).create();mDialog...
分类:
移动开发 时间:
2015-11-09 01:32:22
阅读次数:
5850
在获得布局填充view的时候我们一般用到的是View.inflate()方法,我们每滑动一次getview就要执行一次同样,也要填充一次布局,listview只能显示屏幕那么多的内容,而不用的不会马上销毁而是放到缓存里,这样我们就可以利用这点来进行优化,当有缓存的时候我们就要用到缓存,不用重新调用V...
分类:
其他好文 时间:
2015-10-28 01:26:23
阅读次数:
203
LayoutInflater作用是将layout的xml布局文件实例化为View类对象。获取LayoutInflater的方法有如下三种:LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_I...
分类:
其他好文 时间:
2015-10-27 11:03:18
阅读次数:
178