Search code examples
androidandroid-viewevent-passthrough

Android: Pass touches to the view (Another App) under Floating view


thank you for reading my question. I make a floating view and it has an image inside. It is translucent.

I want this floating view just shows its translucent image and doesn't bother me at all.

Pass touches to the view under

I've seen this article and I've done it. OnTouchListener -> OnTouch -> return false. clickable = false, focusable = false.

But the touch event doesn't pass through my floating view. Would it be possible to solve my problem? Thank you. I'm going to really appreciate it if you could give me just one hint.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:focusable="false"
    android:clickable="false">

...

        @TargetApi(Build.VERSION_CODES.FROYO)
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if(!activate){
                return false;
            }
        }

Solution

  • That's not possible. Communication between apps is limited and there is no touch events communication.