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 5999153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:30:42+00:00 2026-05-23T00:30:42+00:00

I have a screen filled with buttons, but want the onTouch-method to use the

  • 0

I have a screen filled with buttons, but want the onTouch-method to use the entire screen’s coordinates. I first tried using a RelativeLayout with an onTouchListener, but never managed to make it “connect” with the listener (i.e. nothing happened when screen was touched), I also tried putting an ImageView on top of the screen, and then making this view invisible.

This last method gave correct responses to onClicks, but I never managed to make it invisible.

If this is the best solution, which I highly doubt, how do I make the ImageView totally invisible, without losing its onTouchListener (I’ve experimented with white backgroundColor and setAlpha(0)).

Can I somehow make the onTouchListener react to the whole screen, using global coordinates, while the screen is showing (and altering) several buttons (preferably without the invisible imageview)?

If you don’t understand what I’m asking for, feel free to complain about that. I’ll try to fill the gaps as needed.

Edit:

I’ve now managed to resolve the issue by using the regular onTouch-method. I ran into several problems making both ACTION_DOWN and ACTION_MOVE activate the buttons, but I finally got it working. For other people reading this: onInterceptTouchEvent could possibly be used (but I never figured out how to get the screen coordinates instead of the view-coordinates).

  • 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-05-23T00:30:43+00:00Added an answer on May 23, 2026 at 12:30 am

    Sorry if I’m wrong, but I believe I’ve just had a similar problem. I wanted a title screen that displayed a picture and on the picture words that say “Click to go on” or something similar. I messed around for a bit and found that you can make a layout clickable.

        android:focusable="true" 
        android:id="@+id/titlescreenframe">
    

    is in my xml file for my layout. The background image is simply in the background attribute (I realize you aren’t using images)

    Anyway, back in my activity

        private FrameLayout fl;
        ...
        fl = (FrameLayout)findViewById(R.id.titlescreenframe);
        fl.setOnClickListener(this);
    

    And then I use a switch statement to handle that and the buttons that are on the next layout. Here if you need it: Using Switch Statement to Handle Button Clicks

    Seems this should work with other layouts as well, and I don’t have literally any views on my main layout. (unless the layout itself counts as one?)

    Ha! Just realized you said you found the solution. Silly timing. I’ll post on the off-chance this helps someone, happy coding everyone. 🙂

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

Sidebar

Related Questions

i have a screen and it is i want the buttons to put under
I have 9 screen coordinates, each representing one of 9 positions. From the top
I have a screen with two RadioButtonField objects. By default, the first RadioButtonField shows
I have an issue trying to persist entities to the DB using code-first technique.
I have search screen which has 10 fields and involves around 5 to 6
I have a screen that is supposed to have a few large sections of
i have a screen contains just two components 1-textView 2-button the textView starts from
I have a screen with pivot functionality, and I'd very much like just one
i have a screen with multiple little widgets (all with different divs around them).
I have a screen with a webView in my navigation controller stack and when

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.