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

  • Home
  • SEARCH
  • 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 6760293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:02:53+00:00 2026-05-26T14:02:53+00:00

I’m trying to create an android screen that has a TableLayout anchored to the

  • 0

I’m trying to create an android screen that has a TableLayout anchored to the top, then a scrollview to fill middle, and TableLayout anchored to the bottom. I used a RelativeLayout with alignParentTop/alignParentBottom and the bottom TableLayout shows up, but the top one disappears.

Is it possible to have separate sections anchored at both top and bottom with a scrollable region filling the middle? Imagine a button bar on top and bottom with scrollable items in the middle. Here is my layout that was close but doesn’t quite work. I also tried with a TableLayout and 3 rows with the middle one set to fill_parent and ScrollView, but couldn’t get that to work either.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/LinearLayout01"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <TableLayout
       android:id="@+id/CategoryTable01"
        android:stretchColumns="*"
        android:background="#000000"
        android:layout_height="80px"
        android:layout_alignParentTop="true"
        android:layout_width="fill_parent">
        <TableRow 
            android:id="@+id/tr01"
            android:layout_height="fill_parent"
            android:layout_width="wrap_content"
            android:padding="10px"
            android:layout_gravity="center_vertical|center_horizontal">
            <TextView android:text="TOP1" android:textColor="#0000FF" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
            <TextView android:text="TOP2" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
        </TableRow>
   </TableLayout>
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/LinearLayout02"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <TableLayout
        android:id="@+id/TableLayout01"
        android:stretchColumns="*"
        android:background="@drawable/gradient"
        android:layout_height="wrap_content"
        android:paddingLeft="20px"
        android:layout_width="fill_parent">
        <TableRow
            android:id="@+id/TableRow01"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|center_horizontal">
            <TextView android:textColor="#FFFFFF"
                android:textStyle="bold"
                android:textSize="12dip"
                android:text="Sample Line 1"></TextView>
        </TableRow>
        <TableRow
            android:id="@+id/TableRow02"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|center_horizontal">
            <TextView android:textColor="#FFFFFF"
                android:textSize="11dip"
                android:text="Sample Line 2"></TextView>
        </TableRow>
        <TableRow
            android:id="@+id/TableRow03"
            android:layout_height="600px"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical|center_horizontal">
            <TextView android:textColor="#FFFF00"
                android:textSize="11dip"
                android:text="Sample Line 3"></TextView>
        </TableRow>
    </TableLayout>
    </LinearLayout>
    </ScrollView>
  <TableLayout
       android:id="@+id/CategoryTable02"
        android:stretchColumns="*"
        android:background="#000000"
        android:layout_height="80px"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent">
        <TableRow 
            android:id="@+id/tr02"
            android:layout_height="fill_parent"
            android:layout_width="wrap_content"
            android:padding="10px"
            android:layout_gravity="center_vertical|center_horizontal">
            <TextView android:text="ONE" android:textColor="#0000FF" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
            <TextView android:text="TWO" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
            <TextView android:text="THREE" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
            <TextView android:text="FOUR" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
        </TableRow>
   </TableLayout>
</RelativeLayout>

Thanks for any suggestions or help.

Michael

  • 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-26T14:02:54+00:00Added an answer on May 26, 2026 at 2:02 pm

    It is indeed possible. This is how I’ve got it working in one of my apps (I’ve cut out a bunch of irrelevant stuff like ids):

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        <!--this is the action bar at the top of the screen)-->
        <fragment
                android:layout_width="match_parent"
                android:layout_height="40dip" />
    
        <!-- This is the list view in the middle -->
        <ListView 
            android:layout_width="match_parent"
            android:layout_weight="1"
            android:layout_height="0dip">
        </ListView>
    
        <!-- This is a bunch of buttons at the bottom -->
        <RelativeLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="5dip"
            android:gravity="bottom">
        </RelativeLayout>
    
    </LinearLayout>
    

    The key is to set your middle listview to height 0dip and let layout_weight take over – layout_weight is kind of comparable to percentage widths/heights in HTML – if you have 4 different elements with weight 0.25, they’ll each take up a quarter of the screen. So weight 1.0 takes up whatever it can.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I am trying to loop through a bunch of documents I have to put

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.