Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:53:48+00:00 2026-06-05T20:53:48+00:00

Starting with API level 9, there’s android:filterTouchesWhenObscured attribute and corresponding setFilterTouchesWhenObscured method on ViewGroup

  • 0

Starting with API level 9, there’s android:filterTouchesWhenObscured attribute and corresponding setFilterTouchesWhenObscured method on ViewGroup. For example, when a view has onClickListener set and another view obscures that view (e.g. an overlay panel, a toast, or anything else), then touches will not be passed to the obscured view – in my example, onClick will not be fired.

However, this is not available in API level 7 – and for my project the requirement is Android 2.1 and above, which means I have to work with level 7.

Is there an easy way around it? In level 7, this property is essentially hard-coded to FALSE. As a result, I get this strange behavior: on a view, I have a button. When pressed, another view slides into place, covering the view with the button. On this view, there’s its own button, but it doesn’t match the location of the button underneath. Therefore if the user touches the overlay panel in the location where the button underneath is, the onClick of that button is fired again – not what I want/need.

What can I do to prevent onClick firing in this case? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:53:50+00:00Added an answer on June 5, 2026 at 8:53 pm

    Turns out, there is no way of doing it. In Android prior to API level 9, there are two ways around the problem:

    1. Remove listeners from the underlying views (in my case, I have about a dozen of them, which I would need to remove and then re-set after the overlay is made invisible again); or

    2. Add an empty onClickListener (i.e. intercept the click event and do nothing on it) on the entire overlay – this is the way I’m handling it in my case.

    Interestingly, the behavior of an obscured view receiving click events was reported as a bug in an earlier version of Android, but that bug was closed indicating that it’s not a bug but an intended functionality instead (I can’t see why anybody would want that functionality though). I suppose the android:filterTouchesWhenObscured attribute was added in level 9 to appease all the unhappy developers out there 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way in Android (starting with API 8) to create a service
This method in Android, MotionEvent.getPointerCount () , has only been starting to use since
What is the acceptable target API level for new iOS apps? I'm starting iOS
Starting fairly recently, the API has started returning crazy results for 2 word searches.
I know this kind of question has been asked before, for example here: Android:
Starting from this official statement that all xyAndroid versions previous API 11 doesn't support
I've been just starting on Facebook Graph API. How can I call several attributes
I'm just starting to learn the iphone API, and I've done plenty of windows
I am starting to develop with Web Api MVC 4 and created the whole
using gingerbread 2.3.4 api lvl 10. I am starting a service after boot completed.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.