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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:02:27+00:00 2026-06-05T18:02:27+00:00

I have a simple vertical LinearLayout in which there is a button on the

  • 0

I have a simple vertical LinearLayout in which there is a button on the top and a Listview below it.
What I want is that when the button is pressed, it hides (using View.GONE) and the empty space generated by it is filled by ListView.
But after all the efforts, I have not been able to implement it.

I tried invalidate() and onDraw(), I tried giving layout_weight=1 to the ListView, I tried forceLayout(), requestLayout() methods as well but none of them worked.

The strange thing is that if there is EditText or TextView or any other component instead of ListView, its working fine i.e. Edittext etc. go and grab the empty space generated by hiding the Button. But in case of ListView , its not happening.

  • 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-05T18:02:28+00:00Added an answer on June 5, 2026 at 6:02 pm

    This thing is perfectly working in my emulator

        btn1 = (Button) findViewById(R.id.button1);
    
        btn1.setOnClickListener( new OnClickListener() {
    
            public void onClick(View v) {
                // TODO Auto-generated method stub
                new ProgressTask().execute();
                btn1.setVisibility(8);
            }
        })
    

    XML code

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
    
        <ListView
            android:id="@+id/itemlist"
            android:layout_below="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple login box, which is centered to the middle of page (vertical
I have a simple layout like below (which only shows a text TEST): <?xml
I want to make a simple action in which when i press a button
I have a simple LinearLayout with one TextView and one ImageView. I want the
This makes no sense. I have some code that has a simple LinearLayout and
I have one listview in which i am displaying data that i got, it
I have a simple input form; it's a vertical LinearLayout with EditTexts inside a
So I have a fairly simple vertical CSS menu based off of UL. <ul
I have an XSLT script to output a simple vertical menu, however on a
I have simple html code that plays YouTube video after click on the image:

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.