我的错误是无法解析方法getWidth()
;和getHeight()
相同; 我还是新来的android工作室,所以请减少我一些松懈,请向我解释。无法解析方法getwidth和getHeight
请注意,第二个canvas.scale
是我发现的附加代码,应该是为了获得屏幕分辨率的解决方案。
这里是我的代码
private void draw(){
if(visible){
Canvas canvas= holder.lockCanvas();
canvas.save();
movie.draw(canvas, -100, 0);
canvas.restore();
holder.unlockCanvasAndPost(canvas);
movie.setTime((int) (System.currentTimeMillis() % movie.duration()));
handler.removeCallbacks(drawGif);
handler.postDelayed(drawGif,frameDuration);
}
}
@Override
public void onVisibilityChanged(boolean visible) {
super.onVisibilityChanged(visible);
this.visible=visible;
if(visible){
handler.post(drawGif);
} else {
handler.removeCallbacks(drawGif);
}
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
}
方面你得到了什么错误? –
对不起,我忘了提及,但它不能解决方法getWidth();和getHeight(); – johnwestlen
你正在调用getWidth()和getHeight哪个元素?因为你目前的情况,我不认为这是指你认为它的作用。 –