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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:55:13+00:00 2026-05-17T06:55:13+00:00

Okay, so I’ve got this TableLayout, and its full of data – with all

  • 0

Okay, so I’ve got this TableLayout, and its full of data – with all of the rows added programmatically. I’ve got the TableLayout inside of a HorizontalScrollView, which in turn is inside a ScrollView – this gives me scrolling both horizontally and vertically. What I’m trying to do now is add a header row to it that will not scroll. I’ve tried moving things around so that both of my scroll views were actually inside of the TableLayout and adding the TableRows to the HorizontalScrollView; my hope was to be able to then add the header row outside of the scroll views.

The only other thing I can think of is having a second table layout just for the header row, but getting the columns to line up seems like it would be difficult. Any ideas?

  • 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-17T06:55:13+00:00Added an answer on May 17, 2026 at 6:55 am

    One approach is by embedding a TableLayout within another TableLayout’s row and putting the header in the preceding row as seen below. Aligning the data and the header requires the layout_width property of the header View objects and the data’s View objects to be set to the same dip values. Also, the layout_weight property of the inner TableLayout’s View objects must match its corresponding header.
    Now, in the XML below, I have placed 3 TextViews in the inner TableLayout in a single row to match with the column headers. This is just to show how the alignment can be done. You can populate that data programmatically by inflating a layout and adding it at runtime.

    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
    
    
      <TableRow>
        <TextView android:text="Name"
            android:layout_width="100dp"        
            android:layout_column="0"
            android:layout_weight="1"/>
        <TextView android:text="Score"
            android:layout_width="30dp"
            android:layout_column="1"
            android:layout_weight="1">
        </TextView>
        <TextView android:text="Level"
            android:layout_width="30dp"
            android:layout_column="2"
            android:layout_weight="1">
        </TextView>
      </TableRow>
    
        <ScrollView android:layout_height="120dp">      
        <TableLayout android:id="@+id/score_table"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent">          
        <TableRow>
            <TextView android:text="Al"
            android:layout_width="100dp"        
            android:layout_column="0"
            android:layout_weight="1">
            </TextView>
            <TextView android:text="1000"
            android:layout_width="30dp"
            android:layout_column="1"
            android:layout_weight="1">
            </TextView>
            <TextView android:text="2"
            android:layout_width="30dp"
            android:layout_column="2"
            android:layout_weight="1">
            </TextView>
        </TableRow>
      </TableLayout>
      </ScrollView>     
    </TableLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I've looked all over the internet for a good solution to get PHP
Okay, so I'm running a small test webserver on my private network. I've got
Okay so im working on this php image upload system but for some reason
Okay, so this probably sounds terribly nefarious, but I need such capabilities for my
Okay. I know this looks like the typical Why didn't he just Google it
Okay, I might confuse some people who might be able to answer this question,
Okay. So I've got a a little jQuery gallery scroller I wrote to work
Okay, in python one can do this: def foo(monkeys): def bar(monkey): #process and return
Okay. I have this code on my site: <?php session_start(); include database.php; include bruger.php;
Okay, I've been struggling with this for a while now. I have a standard

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.