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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:07:18+00:00 2026-06-03T04:07:18+00:00

I have a simple LinearLayout with ListView inside it ( match_parent both for width

  • 0

I have a simple LinearLayout with ListView inside it (match_parent both for width and height). I need a context menu to show up upon a long touch on ANY place in the ListView. First, I called registerForContextMenu for the ListView. This makes the context menu show up ONLY if the touch is performed on a list item. Then I called registerForContextMenu for the LinearLayout as well, and set it attribute android:longClickable="true". This did not help.

So the question is how can one produce a context menu for a long touch below list items? For example, if we have 1 item in the list view, there is a lot of empty space below the item. Why does it not used for context menu invocation, provided that the list view fills entire parent according to the layout?

  • 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-03T04:07:19+00:00Added an answer on June 3, 2026 at 4:07 am

    I don’t think that long clicking anywhere on the ListView to get a ContextMenu it’s a normal behavior, one the user will expect(especially in your case, with the user clicking the empty space below the ListView and a ListView ContextMenu would appear).

    Anyway, for your example, you can set your ListView height attribute to wrap_content(If I remember right, this is the recommended value) and then register the Contextmenu for the ListView and the parent LinearLayout(of course you’ll have to provide the same code for both).

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

Sidebar

Related Questions

I have a simple horizontal LinearLayout with four TextViews with the same style inside.
I have a simple linearlayout with a textbox a button and a listview, I'm
I have a main menu screen with a simple ListView that contains links to
I have a simple LinearLayout with two Buttons side by side. They are supposed
I have a simple LinearLayout. When I add the android:background to the LinearLayout, the
i have an android application which has a listview for listing 14 items inside
I have an ListView inside a HorizontalScrollView and it works perfectly fine, except for
I have a simple layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent> <LinearLayout
I have a simple LinearLayout with one TextView and one ImageView. I want the
i have content i need to display above my listview and below, so much

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.