user1549332 user1549332 -4 years ago 108
Android Question

How can I interact with elements behind a translucent Android app?

I have found how to create a translucent background for my android app, but so far I haven't found how to interact with what's behind it (the home screen for example).

This post helped me make the app view translucent.

How would one go about allowing the user to interact with what's behind the translucent app? This app is a good example of an app that allows this is the "Transparent Screen" Android app.

Answer Source

A very simple way of understanding stacking of views is to take a book (any book). Think of each page as a view.


  • When you open the book you can see a page (Main View - VISIBLE)
  • When you turn the current page you can see the next page (INVISIBLE - Main View to show the next view. Remember you are only hiding the view, if you set the visibility to GONE this is equivalent to tearing of the current page to view the next page.)

Touch scenarios

  • Assume your first page is a wax page (translucent page similar to your translucent view) so you can see the underlying page
  • When you try to touch a figure on the second page, you are touching the first page although you can see the figure on the second page. It is impossible to touch the figure on the second page through the first page.

Don't be disheartened, since it is a view you will be dealing with and not a paper you can still do what you want to do :)

  • Implement View.OnTouchListener for both your views
  • For translucent view any touch events you get, return FALSE in the method onTouch
  • Android will pass on the touch event to your underlying view.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download