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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:03:15+00:00 2026-05-23T04:03:15+00:00

I have an EditText with a Button next to it. The button is hidden

  • 0

I have an EditText with a Button next to it. The button is hidden at first so the EditText takes up the full screen, which is good. When they tap the EditText I have the button appear next to the EditText, and it resizes itself accordingly. However, when I hide the Button (I set visibility to gone), the EditText does NOT resize to full screen (leaving a gap to the right of the EditText). Any tips?

I have tried putting the EditText and Button in both a LinearLayout and a TableLayout (with stretchable column, etc) and I see the same behavior. I also tried doing some runtime calls to removeView/addView stuff and that didnt work. I also tried calling invalidate() on both the EditText and its parent.

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-05-23T04:03:16+00:00Added an answer on May 23, 2026 at 4:03 am

    I encountered the same question, I want to change the size of an EditText when hiding and showing a Button which stands next to it, but the EditText’s size will not shrink after call setVisibility(View.VISIBLE) on the button. I solved it by adding a android:layout_weight="1" to the EditText.

    The layout xml looks like this:

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:orientation="horizontal">
        <EditText 
            android:id="@+id/search_text" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:layout_weight="1"
            />
        <Button 
            android:id="@+id/hide_btn" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn"
            />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an EditText and a Button set next to each other on the
I have a EditText and button aligned to parent's bottom. When I enter text
friends, i have a EditText on simple activity with a button. when every i
I have two EditText and one Button in my Layout. If the two EditText
I need to have a Edittext beside a Search button . The EditText should
I have an Activity with an EditText , a button and a ListView .
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have had to write my first proper multithreaded coded recently, and realised just how
To use as an example: lets say that I have 2 EditText s and
I can't figure this out. Some apps have an EditText (textbox) with the help

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.