android旋转动画质量 [英] android rotate animation quality

查看:26
本文介绍了android旋转动画质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旋转动画,我将它应用到视图中,代码如下:

I have a rotation animation which I am applying it to a view, here is the code:

    RotateAnimation shake = new RotateAnimation(-3, 3, 10, 10);
    shake.setRepeatCount(Animation.INFINITE);
    shake.setRepeatMode(Animation.REVERSE);
    shake.setDuration(SHAKE_ANIMATION_DURATION);

但是在播放动画时,我的视图边缘会像素化:

But while playing animation, my view's margins get pixelated:

有没有办法解决这个问题?

Is there a way to fix this?

推荐答案

加载图像时,设置抗锯齿标志.
在 XML 中:

When you load your image, set the Anti-alias flag.
In XML:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/tile" 
    android:tileMode="disabled"
    android:antialias="true"/>

即时:

ImageView iv = (ImageView) findViewById(R.id.image);
((BitmapDrawable)iv.getDrawable()).setAntiAlias(true);

这篇关于android旋转动画质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆