たぶん私は何か明白なことを尋ねていますが、解決策が見つからないので、クロスボウであるイメージビューがあり、画面上のタッチした場所にショットしたいのですが、postRotate を使用して場所の関数で回転させます問題は、触れるたびに古い角度に新しい角度が追加されることです。ImageView の実際の角度を取得する方法はありますか?
int scrWidth = getWindowManager().getDefaultDisplay().getWidth();
int scrHeight = getWindowManager().getDefaultDisplay().getHeight();
float x=event.getX();//capturamos x e y
float y=event.getY();
float i=0;
if(y<(scrHeight/2)){
float yf=(scrHeight/2)-y;//obtenemos la y respecto a la mitad de la pantalla
double alfa=Math.toDegrees(Math.atan2(yf, x));//encontramos el angulo para las x e y encontradas
float beta= (float) alfa; //convertimos a float para rotar
beta=beta+i;
matrix.postRotate(-beta, ballesta.getWidth()/2,ballesta.getHeight()/2); //primer valor angulo, segundo y tercero punto de ancla de la imagen
ballesta.setImageMatrix(matrix);
}
if(y>(scrHeight/2)){
float yf=y-(scrHeight/2);//obtenemos la y respecto a la mitad de la pantalla
double alfa=Math.toDegrees(Math.atan2(yf, x));//encontramos el angulo para las x e y encontradas
float beta= (float) alfa; //convertimos a float para rotar
beta=beta+i;
matrix.postRotate(beta, ballesta.getWidth()/2,ballesta.getHeight()/2);
ballesta.setImageMatrix(matrix);
}