gpt4 book ai didi

java - 将图像旋转到特定方向

转载 作者:行者123 更新时间:2023-11-29 03:37:19 24 4
gpt4 key购买 nike

我正在尝试旋转箭头以指向某个特定位置

  float bearing = myLoc.bearingTo(mecca);
RotateAnimation rotate = new RotateAnimation(0, bearing, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
arrow.setAnimation(rotate);
rotate.start();

不管它如何旋转,不到一秒它就会回到原来的位置。我怎样才能让它像指南针一样旋转。

最佳答案

另一种旋转 imageView 的简单方法:

Matrix matrix=new Matrix();
imageView.setScaleType(ScaleType.MATRIX); //required
matrix.postRotate((float) angle, pivX, pivY);
arrow.setImageMatrix(matrix);

关于java - 将图像旋转到特定方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14837305/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com