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

  • 相关阅读:
    explicit for ctors taking more than one argument
    Python 的 encode 和 decode
    Tripwire配置和运行
    man twadmin
    Tripwire策略说明
    Tripwire安装
    [部分翻译] tripwire(8)
    snort-2.9.3.1安装
    [转载] snort中文手册
    wireshark_1.2.11安装
  • 原文地址:https://www.cnblogs.com/bianhao007/p/3499534.html
Copyright © 2011-2022 走看看