Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 4.0:canvas.setViewport错误_Android - Fatal编程技术网

Android 4.0:canvas.setViewport错误

Android 4.0:canvas.setViewport错误,android,Android,我的代码出错了。 无法为类型canvas定义方法setViewPort(int,int) 我正在尝试在ImageView上实现多点触摸功能,intire类太长,无法在此处显示,但如果您需要更多信息,请发表评论 @Override protected void onDraw(Canvas canvas) { if(layout) { if(!viewSet) { //line that's causing issue

我的代码出错了。 无法为类型canvas定义方法setViewPort(int,int)

我正在尝试在ImageView上实现多点触摸功能,intire类太长,无法在此处显示,但如果您需要更多信息,请发表评论

    @Override
        protected void onDraw(Canvas canvas) {
            if(layout) {
                if(!viewSet) {
//line that's causing issue                 
canvas.setViewport(displayWidth, displayHeight);
                    viewSet = true;
                }
搞不清楚问题出在哪里,有所有必要的进口品等

我使用的是安卓4.0吗

谢谢


Shaw

以下是谷歌集团的Romain Guy的答案:

“这个方法被删除了,因为它没有任何效果。这是一个错误。” 旧的失败实验的残余。”


同样,在这里,查看文档,该方法不再被提及,也没有被标记为已弃用。我以前在早期的SDK版本中使用过这种方法,我也在google群组中发布了这个问题: