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

  • SEARCH
  • Home
  • 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 7890613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:24:01+00:00 2026-06-03T06:24:01+00:00

My question is simple: How to disable any event on a View in Android?

  • 0

My question is simple: How to disable any event on a View in Android? (including removing its focussability, like I just want it to be there visually but be inexistant on everything else)
And does it work on a whole view tree? (like if I disable events on the root, all the events will be disabled for its children?).

Now, before you say anything I have tried all the following:

  • setEnabled
  • setFocusable
  • setSelected
  • setClickable
  • setActivated

And none of these methods appear to work, seriously.

I have tried them directly on a WebView, as well as on the parent layout on everything but I am still able to interact with it.

Any idea?

Thanks!

EDIT#1

The solution that consists in adding a view on top of the view that needs to be disabled doesn’t work. Actually, it’s still possible to click on the inner view, I have tried with a simple example:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="#ff0000">
        <Button
            android:id="@+id/button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Click Me!"
        />
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#00000000"
    />
</FrameLayout>

Here it’s still possible to click on the button.

EDIT#2

The reason why I want to do this is related to the following question that I asked weeks ago.

What I have is a ListViewacting as a navigation bar which is underneath a View that holds the content of my app. The problem with this implementation is that when I try to scroll through the ListView when there is a focusable view in the layer on top of it, well the ListView doesn’t scroll and instead it’s the top view that takes focus (That’s the case when there is a
Webview or an EditText etc.).

So yes as mentioned in one of the answers, I can disable any click events on a WebView by overriding setOnTouchListener but the view remains focussed and I think this is the reason why I am still having the same issue with my navigation bar.

  • 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-03T06:24:02+00:00Added an answer on June 3, 2026 at 6:24 am

    Simply put a view on top of your view. You can toggle it on off by setting view.visibility = gone/visible.

    <FrameLayout>
    <WebView/>
    <FrameLayout This view will be on top/>
    </FrameLayout>
    

    Edit: Just stumpled upon this link: https://stackoverflow.com/a/3856199/969325
    Basically disables all touch event for the webview. Tryed that?

    Edit 2 reedit: Try to set the visibility to gone for the the top view below your listview.

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

Sidebar

Related Questions

Simple question here: is there any way to convert from a jagged array to
This might be a simple question.but,does any one know how to disable a button
I think this is a simple question. How do I disable copy from a
Beginner here, I have a simple question. In Android what would be the best
I have a -as I hope- very simple question: how to disable an UISearchBar
I'm calling a subprocess and want to disable any output to my shell. I'm
I can't figure out, or find any solutions to a very simple question: How
Question says it all. Is there a best recipe to follow to disable user
So, here's a weird question: Is there a way for me to disable the
Question simple and quick: I have started to use Netbeans to write some code

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.