无风子

android 容易出问题的地方

   1.没有加权限

    

     2.  LinearLayout没有指定 布局方式

 

   3.  Fragment操作问题  

                   The specified child already has a parent. You must call removeView() on the child's parent first

       问题分析  child已经存在parent

       因此:View view = inflater.inflate(R.layout.fragment_buttom, container);

        改为View view = inflater.inflate(R.layout.fragment_buttom, container, false);  

       查看源码发现

        

public View inflate(int resource, ViewGroup root) {
        return inflate(resource, root, root != null);
   }

        就可以发现问题了

  

 

     4.错误

            android.app.SuperNotCalledException: Fragment BottomFragment{52a40288 #0 id=0x7f0c0050} did not call through to super.onActivityCreated()

      分析,它的意思是没有 调用 super.onActivityCreated()  加上就好了

      原因 父类做了许多初始化的操作,没有调用所以不能启动activity

 

 

     5.给控件添加点击事件,使用 OnClickListener接口,注意要 用控件etOnClickListener(this);  否则无响应

posted on 2015-07-02 18:37  无风子  阅读(159)  评论(0编辑  收藏  举报

导航