LayoutInflater的用法
2015-07-17 10:09
375 查看
Instead of doing
do
It will inflate it with the given parent, but won’t attach it to the parent.
为Fragment添加主题:
convertView = infalInflater.inflate(R.layout.list_item, null);
do
convertView = infalInflater.inflate(R.layout.list_item, parent, false);
It will inflate it with the given parent, but won’t attach it to the parent.
为Fragment添加主题:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.Theme_PageIndicatorDefaults); LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper); rootView = localInflater.inflate(R.layout.fragment_packet, null); rootView.findViewById(R.id.btn_operate).setOnClickListener(this); initFrame(); return rootView; }
相关文章推荐
- ASP.NET 泛型类型 Dictionary操作
- PE文件结构(五岁以下儿童)基地搬迁
- 偷懒代码块之Handler延时执行操作
- 经验分享:CSS div浮动(float,clear)
- 课程设计——简单银行储蓄系统(代码)(并不完善版)
- 面试题:两个线程交替运行若干次
- Redis数据类型--List
- Java LinkedList特有方法程序小解 && 使用LinkedList 模拟一个堆栈或者队列数据结构。
- peak num
- Object之魔术函数__call() 处理错误调用
- java 值传递和引用传递
- 获取本机所有进程的完整路径
- 用svg制作富有动态的tooltip
- [小技巧] 如何快速确认内核的一些功能
- Beginning
- eclipse快捷键
- linux下一个php未找到php型材php.ini解决方案
- coco2dx3.x打包APK
- 调用调色板在对话框中画一条直线
- 有哪些方法可以把ppt转成pdf的格式