Rotating an image, and displaying angle of rotation

↘锁芯ラ 提交于 2019-11-28 02:11:18

you may try to override applyTransformation

    RotateAnimation rpmNeedleDeflection = new RotateAnimation(fromDegrees, toDegrees, ...){
                protected void applyTransformation(float interpolatedTime,Transformation t) {
                    float currentDegree = fromDegrees+(toDegrees-fromDegrees)*interpolatedTime;
                    super.applyTransformation(interpolatedTime, t);
                };

            }

Use this code to keep the needle in final position:

if(currentDegree==toDegrees)
        {
            needle.refreshDrawableState();
            RotateAnimation nrpmNeedleDeflection=new rotateAnimation(toDegrees,toDegrees...);
            nrpmNeedleDeflection.setDuration(1); 
            nrpmNeedleDeflection.setFillAfter(true);
            needle.startAnimation(nrpmNeedleDeflection);
         }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!