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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:40:55+00:00 2026-05-27T18:40:55+00:00

I am currently working on an android project where I want to have the

  • 0

I am currently working on an android project where I want to have the screen split into three sections.

The first section would be a title which doesn’t move positioned at the top of the screen.
The second section is the main content which is scrollable
The third section are two buttons which are fixed to the bottom of the screen.

In this setup the top and bottom would stay on screen and only the centre part of the screen would be scrollable.

For some reason, when I have tried to do this the top and middle work fine but the bottom which have the buttons have never be shown.

Below is the code that I have used to try to get this working

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/start_eulaTitle"
            android:textSize="15dp"
            android:textStyle="bold" />
        <ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="match_parent">
            <TextView 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/start_eula" />
        </ScrollView>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
        <Button android:id="@+id/start_btnAgree"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/button_agree" />
        </LinearLayout>
    </LinearLayout>

Thanks for any help you can provide.

  • 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-27T18:40:55+00:00Added an answer on May 27, 2026 at 6:40 pm

    A RelativeLayout is probably the way to go to accomplish what you’re looking for. Something like:

    <?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" >
    
        <TextView
            android:id="@+id/title_textview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/start_eulaTitle"
            android:textSize="15dp"
            android:textStyle="bold" />
    
        <ScrollView
            android:id="scrolling_layout"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/button_layout"
            android:layout_below="@+id/title_textview" >
    
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/start_eula" />
        </ScrollView>
    
        <LinearLayout
            android:id="@+id/button_layout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="horizontal" >
    
            <Button
                android:id="@+id/start_btnAgree"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/button_agree" />
    
            <Button
                android:id="@+id/start_btnAgree"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/button_agree" />
        </LinearLayout>
    
    </RelativeLayout>
    

    This basically tells the LinearLayout with the buttons to always align to the bottom of the screen, while the title TextView will by default sit at the left top. The scrollable area is defined to stay inbetween these two: below the title but above the buttons.

    //Edit: If you really want to stick with a LinearLayout as root, you could potentially also do the following:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/start_eulaTitle"
            android:textSize="15dp"
            android:textStyle="bold" />
    
        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="0dp" 
            android:layout_weight="1">
    
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/start_eula" />
        </ScrollView>
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
    
            <Button
                android:id="@+id/start_btnAgree"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/button_agree" 
                android:layout_weight="1"/>
    
            <Button
                android:id="@+id/start_btnAgree"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/button_agree"
                android:layout_weight="1" />
        </LinearLayout>
    
    </LinearLayout>
    

    The magic happens by setting a weight of 1 to the ScrollView. This will dynamically stretch the view as much as possible, without pushing anything off-screen.

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

Sidebar

Related Questions

I am currently working on android project where I want to have a text
I am currently working on an android project and I have an activity, lets
I am currently working on an android project. I am trying to have an
I am currently working on android project, I want to allow the user to
I'm currently working on a project that's based on Android. Without getting into many
I am currently working on an Android project where I'd have to use maven.
I'm currently working on an Android project, where I have to collect data from
I am currently working on an android project and I have an activity that
I have a android project, I am working on and it, currently does not
I am currently working on android project where I am using a custom list

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.