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);  
        ......  
    }

  • 相关阅读:
    设计模式学习心得5
    HTTP协议 (六) 状态码详解
    HTTP协议 (五) 代理
    HTTP协议 (四) 缓存
    HTTP协议 (三) 压缩
    HTTP协议 (二) 基本认证
    HTTP协议 (一) HTTP协议详解
    java中abstract和interface的區別(轉)
    基于TCP的字符串传输程序
    文件比较
  • 原文地址:https://www.cnblogs.com/bianhao007/p/3499534.html
Copyright © 2011-2022 走看看