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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:09:33+00:00 2026-05-24T17:09:33+00:00

I have a EditText field within a LinearLayout which is in a scrollview. As

  • 0

I have a EditText field within a LinearLayout which is in a scrollview. As long as the ScrollView is not there the layout_weight="1.0" lets my EditText to occupy the remaining screen. But as soon as I wrap the LinearLayout within a ScrollView, It changes the EditText to a single line and layout_weight doesn’t work.

My complete layout file

<LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent" android:layout_height="fill_parent"     android:orientation="vertical" >        

<TextView android:id="@+id/titleTextView"       
          style="@style/TitleHeaderBarText"     
          android:text="@string/announcement" />        

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout  
         android:layout_width="match_parent" 
         android:layout_height="fill_parent"    
         android:orientation="vertical" 
         android:gravity="right" >

                <TextView 
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Subject:" 
                    android:textSize="16sp" />

                <EditText 
                    android:id="@+id/et_subject"
                    android:layout_width="match_parent" 
                    android:layout_height="wrap_content" />

               <TextView
                    android:layout_width="match_parent" 
                    android:layout_height="wrap_content"
                    android:text="Announcement:" 
                    android:textSize="16sp" />

                <EditText
                    android:id="@+id/et_announcement"
                    android:layout_width="match_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1.0" />

                <Button
                    android:id="@+id/btn_save"
                    android:layout_width="wrap_content" 
                    android:layout_height="wrap_content"
                    android:paddingLeft="24sp" 
                    android:paddingRight="24dp"
                    android:text="Save" />      

       </LinearLayout>  
</ScrollView>

</LinearLayout>

I don’t seem to understand what I am doing wrong. Any suggestions please on how to get the EditText to occupy the rest of the screen from within the LinearLayout which is in a ScrollView.

Thank you.

EDIT
Facing the same problem again and this is my layout.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView android:id="@+id/titleTextView"
        style="@style/TitleHeaderBarText"
        android:text="@string/login_title" />

    <ScrollView
        android:id="@+id/sv_weight_tell_us"
        android:layout_width="match_parent" android:layout_height="match_parent"
        android:background="@drawable/bg_light_radial_pink" >
        <LinearLayout 
            android:layout_width="match_parent" android:layout_height="match_parent"
            android:padding="12dp"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/login_header"
                android:layout_width="match_parent" android:layout_height="wrap_content"
                android:text="Login" />

            <TableLayout 
                android:layout_width="match_parent" android:layout_height="wrap_content"
                android:stretchColumns="1" >
                <TableRow>
                    <TextView
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:paddingRight="20dp"
                        android:text="@string/username" />
                    <EditText
                        android:id="@+id/et_username"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                </TableRow>
                <TableRow>
                    <TextView
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:text="@string/password" />
                    <EditText
                        android:id="@+id/et_password"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:inputType="textPassword" />
                </TableRow>
                <TableRow>
                    <View/>
                    <Button
                        android:id="@+id/btn_login"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:text="@string/login"
                        android:padding="12dp" />
                </TableRow>
            </TableLayout>

            <ProgressBar
                android:id="@+id/pb_1"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:indeterminate="true"
                style="?android:attr/progressBarStyleSmall"
                android:visibility="invisible" />

            <TextView
                android:layout_width="wrap_content" android:layout_height="match_parent"
                android:layout_weight="1.0" android:gravity="bottom"
                android:text="@string/dont_have_Q" />           
            <TextView
                android:id="@+id/tv_sign_up"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:text="@string/sign_up_" />

        </LinearLayout>
    </ScrollView>

</LinearLayout>
  • 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-24T17:09:33+00:00Added an answer on May 24, 2026 at 5:09 pm

    You need to add the ScrollView attribute android:fillViewport="true":

    ...
    <ScrollView
        android:id="@+id/sv_weight_tell_us"
        android:layout_width="match_parent" android:layout_height="match_parent"
        android:background="@drawable/bg_light_radial_pink"
        android:fillViewport="true" >
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a screen where the first field is an EditText, and it gains
I have an activity that contains several user editable items (an EditText field, RatingBar,
To use as an example: lets say that I have 2 EditText s and
I have an EditText field for the user to enter their weight in lbs.
Whenever I have an EditText field in my android application, it is highlighted with
I have a layout which has one large EditText view at the top +
I am using an ArrayList within my code which gets populated by a EditText
I have a list that will filter in input in an EditText field and
I have this EditText field inside of one activity, and I want it so
I want to open my made calculator after clicking on edittext field. I have

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.