Android攻城狮一枚...

IP属地:湖北
这样会不会更好一点。Matrix不去转换Rect,而是转换点击的点。点击的点和旋转后Rect真实区域是一个相对位置,因为Rect.contains不会旋转改变,所以只用把点击的点反着旋转相同即可,保持相对位置不变。
private boolean isInRectangle(float pointX, float pointY) {
float[] floats = new float[]{pointX, pointY};
Matrix matrix = new Matrix();
matrix.setRotate(-(float) mRotation, mRect.centerX(), mRect.centerY());
matrix.mapPoints(floats);
return mRect.contains(floats[0], floats[1]);
}