The parent of your view should have the android:clipChildren disabled (from the layout file or using setClipChildren(false) ).
But with this method, you will not get touch events outside the bounds of the view clip. You can work by sending them from your activity or by creating a custom ViewGroup parent.
I am using another hack that seems to work in my case, the trick is to save my own transformation matrix. Then you need to overload many ViewGroup methods to make it work. For example:
@Override protected void dispatchDraw(Canvas canvas) { Log.d(TAG, "dispatchDraw " + canvas); canvas.save(); canvas.concat(mMatrix); super.dispatchDraw(canvas); canvas.restore(); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { Log.d(TAG, "dispatchTouchEvent " + ev); ev.transform(getInvMatrix());
Piezoid
source share