首页 > 移动平台 > 详细

android之针对fragment多次调用onCreateView的问题

时间:2014-10-08 23:11:17      阅读:1796      评论:0      收藏:0      [点我收藏+]

直接上解决的代码模块

private View rootView;
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (null != rootView) {
            ViewGroup parent = (ViewGroup) rootView.getParent();
            if (null != parent) {
                parent.removeView(rootView);
            }
        } else {
            rootView = inflater.inflate(layoutId, null);
            initView(rootView);// 控件初始化
        }
        return rootView;
    }

 

android之针对fragment多次调用onCreateView的问题

原文:http://www.cnblogs.com/lee0oo0/p/4011377.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!