有关于子控件填充容器的异常说明
来源:互联网 发布:手机淘宝怎么买游戏号 编辑:程序博客网 时间:2024/04/30 14:58
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
代码如下:在编写fragment的过程中
public class DetailFragment extends Fragment {
BookContent.Book book;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View root=inflater.inflate(R.layout.fragmentdetail, container);
if(book!=null){
((TextView)root.findViewById(R.id.book_title)).setText(book.title);
System.out.println(book.title);
((TextView)root.findViewById(R.id.book_desc)).setText(book.detail);
}
return root;
}
其中通过View root=inflater.inflate(R.layout.fragmentdetail, container);获得view为子控件,不能填充fragment容器需要解除与父空间的关系,所以要调用inflate的
View root=inflater.inflate(R.layout.fragmentdetail, container,false);//第三个参数是否解除与父控件之间的联系
- 有关于子控件填充容器的异常说明
- 有关于oracle参数文件的说明
- 有关于volatile的说明(含题目)
- 有关于redis缓存的启动说明
- 子容器垂直居中于父容器的方案
- 有关于BitmapEx 类的一些说明文件
- 有关于100动态规划专栏的说明
- 有关于补码的原理,举个例子
- 有关于MSComm控件详解
- 子控件自动换行的父容器
- 容器内的子控件居中显示
- 有关于java中的一些容器问题
- 有关于objectdatasource的
- 有关于web.xml中的配置说明
- 有关于application/x-www-form-urlencoded等字符编码的解释说明
- 【WPF】设置ListBox容器子控件的布局
- SqlServer 填充因子的说明
- 有关于NBear的简介
- 《JavaScript高级程序设计 第三版》学习笔记 (十)DOM详解
- iOS 代码实现获得应用的版本号(Version/Build)
- 小米采用意法半导体低功耗电磁罗盘模块LSM303D
- poj 2643 stl_map(竞选啦)
- jasperreport ireport PDF中文字体完美解决方案
- 有关于子控件填充容器的异常说明
- 项目管理实战十步法——中国印钞造币总公司培训记
- 接口与多态实现功能的扩展
- C++中explicit关键字的作用
- 将PDF文件Open In MyApp
- 宝宝嘻哈(有一段时间了居然忘记是什么了,不管,先记录再说啦!)
- CocoaPods详解之-Podfile.lock
- java io
- 项目管理实战十步法——支付宝培训记