zoukankan      html  css  js  c++  java
  • Custom view com/android/cricle/Circleview is missing constructor used by tools: (Context) or (Context,AttributeSet) or (Context,AttributeSet,int)(转)

    当安卓中出现Custom view com/android/cricle/Circleview is missing constructor used by tools: (Context) or   (Context,AttributeSet) or (Context,AttributeSet,int)警告时,说明该文件中有个类继承自View或其子类。该类需要向其超类传递参数,形式如(Context) or (Context,AttributeSet) or (Context,AttributeSet,int)。

    但是有的时候,即使已经向超类传递了一个Context类型的参数,却依然报上面这个警告。

    例如我有一个继承自SurfaceView的类,其构造器如下:

    public AndroidFastRenderView(Context game, Bitmap framebuffer) {  
        super(game);  
        ......  
    }

    但是如果我把这个构造器改成:

    public AndroidFastRenderView(Context game) {  
        super(game);  
        ......  
    }

    然后警告就消失了。

    这个应该是错误检查工具的bug吧。可以直接禁止这个警告:

    @SuppressLint("ViewConstructor")  
    public AndroidFastRenderView(Context game, Bitmap framebuffer) {  
        super(game);  
        ......  
    }

  • 相关阅读:
    linux压缩与解压
    simple 单例
    模板字符串
    变量的解构赋值
    let和const关键字
    React的基本认识
    Docker安装Nginx
    jenkins创建工程
    Jenkins系统初始化配置
    在CentOS上使用Docker镜像安装Jenkins
  • 原文地址:https://www.cnblogs.com/bianhao007/p/3499534.html
Copyright © 2011-2022 走看看