[英]Android ImageView: How can I get the current rotation angle?
我旋转图像视图以指向所需方向的箭头。 在执行下一次旋转(使用RotateAnimation)之前,如何获得ImageView的当前旋转角度?
谢谢
您需要将先前的旋转角度存储在某个变量中。
保存旋转角度:
ImageView arrow = (ImageView) findViewById(R.id.arrow);
float x = arrow.getPivotX();
float y = arrow.getPivotY();
RotateAnimation anim = new RotateAnimation(arrowRotateStartAngle, arrowRotateXAngle, arrow.getWidth()/2, arrow.getHeight()/2);
anim.setFillAfter(true);
anim.setDuration(1000);
arrow.startAnimation(anim);
temRotate = arrowRotateStartAngle;
arrowRotateStartAngle = arrowRotateXAngle;
arrowRotateXAngle = temRotate;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.