当我在ImageView中旋转图像时,图像的一部分消失了

瓦卡斯·艾哈迈德·安萨里(Waqas Ahmed Ansari)

我需要将图像旋转一定程度。但是当我旋转时,它的某些部分消失,消失程度随度数而增加,最后,整个图像消失,并在经过编程的时间后出现。问题是什么?我正在使用下面的代码旋转。

        @Override
        public void onClick(View v) {
            AnimationSet animSet = new AnimationSet(true);
            animSet.setInterpolator(new DecelerateInterpolator());
            animSet.setFillAfter(true);
            animSet.setFillEnabled(true);

            final RotateAnimation animRotate = new RotateAnimation(0.0f, 155.0f,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f, 
                RotateAnimation.RELATIVE_TO_SELF, 0.5f);

            animRotate.setDuration(5000);
            animRotate.setFillAfter(true);
            animSet.addAnimation(animRotate);

            myImageView.startAnimation(animSet);
        }
    });
Ellesmera

这可能与https://code.google.com/p/android/issues/detail?id=70914某些设备(主要是Nexus 5)上的旋转损坏有关。您可能需要尝试将图层类型设置为硬件或软件。

view.setLayerType(View.LAYER_TYPE_HARDWARE, null);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章