• 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);  否则无响应

  • 相关阅读:
    实例天天向上的力量
    实例天天向上的力量
    数字类型及操作
    基本数据类型
    函数与模块
    Turtle库(海龟)
    python猛蛇绘制
    输出函数
    循环语句
    集合
  • 原文地址:https://www.cnblogs.com/Free-Wind/p/4616839.html
Copyright © 2020-2023  润新知