ViewPager代替Gallery效果,gallery弊端在于滑动的时候ViewPageritem需要一个布局Layout;importandroid.content.Context;
importandroid.content.Intent;
importandroid.view.LayoutInflater;
importandroid.view.View;
importandroid.widget.ImageView;
importandroid.widget..
分类:
其他好文 时间:
2014-05-09 21:33:39
阅读次数:
380
在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById()。不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例化;而findViewById()是找xml布局文件下的具体widget控件(如
Button、Te...
分类:
移动开发 时间:
2014-05-08 11:56:47
阅读次数:
464
如今Android上很多应用都采用底部菜单控制更新的UI这种框架,例如新浪微博
点击底部菜单的选项可以更新界面。底部菜单可以使用TabHost来实现,不过用过TabHost的人都知道自定义TabHost究竟是有多麻烦的,原生TabHost的风格是不依附屏幕的底部的,要依附底部就要重写布局。
TabHost设置的Container可以管理UI的显示,UI可以用LayoutInflater动态生成,也可以是Activity,但不好管理Activity的生命周期。然后用TabHost控制显示UI的显示。...
分类:
移动开发 时间:
2014-05-07 13:32:36
阅读次数:
465
LayoutInflater
inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);View
layout = inflater.inflate(R.layout.main, null);...
分类:
其他好文 时间:
2014-05-01 13:10:22
阅读次数:
310
第一步 Java代码
finalLayoutInflaterinflater=LayoutInflater.from(this);第二步:获取需要被添加控件的布局Java代码
finalLinearLayoutlin=(LinearLayout)findViewById(R.id.LinearLay...
分类:
移动开发 时间:
2014-04-28 02:54:25
阅读次数:
515