Android 3.0后引入了ListFragment,默认情况下Android已经给我们提供了一些简单的交互,但是那个进度条太丑了。

想自己定制下布局,在onCreateView里面inflat自定义layout的时候一直宝这个错‘The specified child already has a parent. You must call removeView() on the child's parent first.’ 各种尝试后发现inflat的第三个参数必须是false,

inflater.inflate(R.layout.list_layout, container, false);
记得以前不传第三个参数默认是false,今天总算又被坑了一回。

第三个参数的意思是inflat出来的view是否附在rootview上面(这里的container)

attachToRoot Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.


更多相关文章

  1. android五种布局模式
  2. Android的布局管理器与java中的实现方式不同
  3. 布局管理器
  4. 如何实现Android 布局背景模糊化处理
  5. android am 启动activity service or broadcast及参数传递
  6. Android五大布局对象

随机推荐

  1. Android(安卓)实现手机震动功能
  2. Android自学笔记之短信发送器
  3. Android(安卓)使用decodeFile方法加载手
  4. android 代码中设置字体大小
  5. 打包错误:`Error:Execution failed for ta
  6. Android(安卓)获取通讯录联系人
  7. android 强制开启 GPS
  8. 多线程实现android更新进度条
  9. android View根据自己获取焦点的情况执行
  10. Type View requires API level 14 (curre