缩放画布

时间:2016-03-14 18:11:48

标签: java android android-studio canvas scale

我缩放画布以适应所有设备屏幕,
但是在缩放背景后,对象显示出像素和模糊 我如何保持规模但解决了这个问题呢? 谢谢你的帮助! 代码:
public void draw(Canvas canvas) { final float scaleFactorX = getWidth()/(WIDTH*1.f); final float scaleFactorY = getHeight()/(HEIGHT*1.f);

    if(canvas!=null) {
        final int savedState = canvas.save();
        canvas.scale(scaleFactorX, scaleFactorY);
        bg.draw(canvas);
        btn.draw(canvas);
        if(!dissapear) {
            player.draw(canvas);
        }

0 个答案:

没有答案