LinearLayout layout = (LinearLayout) mInflater.inflate( R.layout.cell_check_item, null); LinearLayout.LayoutParams param...
分类:
移动开发 时间:
2015-05-13 18:52:17
阅读次数:
472
仿微信右上角弹出框
1、利用popwindow实现
2、popwindow的位置居于右上角
新建,弹出popwindow:
/** 弹popwindow **/
tv = (TextView) findViewById(R.id.textView1);
view_pop = LayoutInflater.from(MainActivity.this).inflate(...
分类:
微信 时间:
2015-05-07 22:12:41
阅读次数:
741
今天自定义了一个组合控件,与到了个奇葩问题:我自定义了一个RelativeLayout,这个layout内有多个子控件。但奇怪的是这些子控件一直显示不出来。调试了一下午,竟然是因为在获取(inflate)布局时没有添加到Root。
分类:
移动开发 时间:
2015-05-07 20:18:50
阅读次数:
138
LayoutInflater的inflate函数用法详解
LayoutInflater作用是将layout的xml布局文件实例化为View类对象。
获取LayoutInflater的方法有如下三种:
?
LayoutInflater
inflater=(LayoutInflater)context.getSyste...
分类:
其他好文 时间:
2015-05-03 10:41:12
阅读次数:
121
自定义控件的步骤自定义一个View继承ViewGroup等相似效果的View;重写构造方法可以在构造方法中附加要显示的内容如下:View.inflate(context, R.layout.ui_setting_view, this);这里就是让这个填充出来的View显示到当前我们自定义的这个布局中...
分类:
其他好文 时间:
2015-04-28 18:17:23
阅读次数:
167
写程序的时候,大部分的时候,我们都会知道添加try,catch的代码块,比如
try {
mRoot = inflater.inflate(R.layout.fragment_setting, container, false);
initView(mRoot);
} catch (Exception e) {...
分类:
移动开发 时间:
2015-04-28 16:17:20
阅读次数:
186
LayoutInflater与findViewById的用法有很多可比较之处。如:他们都可以通过id返回View。LayoutInflater inflater = getLayoutInflater();View layout = inflater.inflate(R.layout.custom_...
分类:
移动开发 时间:
2015-04-24 00:46:15
阅读次数:
326
PopupWindow popupWindow = new PopupWindow(this); popupWindow.setContentView(LayoutInflater.from(this).inflate(R.layout.activity_main, null)); popu...
onCreateOptionsMenu(Menu menu)方法中我们能够通过getMenuInflater().inflate(R.menu.list_option, menu);来构建一个菜单,并通过
1
menu.findItem(R.id.menu)
获得具体的一个菜单项。但这个onCrea...
分类:
其他好文 时间:
2015-04-21 14:41:52
阅读次数:
126
1.ViewStub延迟加载
ViewStub是一个不可见的,大小为0的View,最佳用途就是实现View的延迟加载,在需要的时候再加载View,可Java中常见的性能优化方法延迟加载一样。
当调用ViewStub的setVisibility函数设置为可见或则调用inflate初始化该View的时候,ViewStub引用的资源开始初始化,然后引用的资源替代ViewStub自己的位置填充在V...
分类:
移动开发 时间:
2015-04-17 15:47:16
阅读次数:
163