4

我有用于在视图目标内触摸事件坐标的方法。

public boolean isInsideView( View view,float x, float y){
        int location[] = new int[2];
        view.getLocationInWindow(location);
        int viewX = location[0];
        int viewY = location[1];

        if(( x > viewX && x < (viewX +  view.getWidth())) &&
                ( y > viewY && y < (viewY + view.getHeight()))){
            return true;
        } else {
            return false;
        }
    }

但是当视图目标设置为旋转时不起作用。

           <ImageView
            android:id="@+id/v_checkpoint1_1"
            android:layout_width="50dp"
            android:layout_height="150dp"
            android:background="@android:color/holo_green_dark"
            android:rotation="-25" />

请帮我解决这个问题。非常感谢。

4

0 回答 0