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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:30:03+00:00 2026-05-28T06:30:03+00:00

Does anyone know whether it is possible to add columns to a TableLayout in

  • 0

Does anyone know whether it is possible to add columns to a TableLayout in Android? I need to display a relatively huge amount of data within a table. Obviously, this shouldn’t be displayed all in one column.

You can add rows by creating a TableRow()-Object. Furthermore there’s some kinda xml-parameter, but I don’t know how to access it via the Java-Code.

         TextView val = new TextView(this);
         val.setText(args.get(i));
         table.addView(val);
         table.addView(tr,new TableLayout.LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));

I was unable to find a matching value in the TableRow.LayoutParams that worked for me. But probably I tried to use it in the wrong way.

         table.addView(val,new TableRow.LayoutParams(
                 LayoutParams. ?? ));
  • 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-28T06:30:04+00:00Added an answer on May 28, 2026 at 6:30 am

    As you add new views to the tablet row each view becomes a new “column”.

    So, if you do something like this (assuming your row data is in List rowData and your column data is in a List in rowData.

    for (RowData rd : rowData)
    {
        TableRow row = new TableRow(this);
        for (DataPoint dp : rd.getDataPoints())
        {
           TextView tv = new TextView(this);
           tv.setText(dp.getText());
    
           /* any other styling stuff here */
    
           row.addView(tv);
         }
     table.addView(row);
    }
    

    That will result in a table, with multiple columns, all within a single table.

    For layout params, you can use:

    new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, (float) 5);
    

    What that means is 0 width, wrap content on height, then a relative “weight” for the width. Android will layout your columns nicely with this.

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

Sidebar

Related Questions

Does anyone know whether if its possible to insert binary data into an SQL
Does anyone know whether it's possible to modify the workflow actions of a SharePoint
Does anyone know if it is possible to detect whether the browser has closed
Does anyone know if it is possible to reliably determine (programattically C/C++...) whether or
Does anyone know whether there's a way to mock Entity Data Provider so Unit
Does anyone know whether it is possible to change the tab order that tabs
Does anyone know whether it is possible to make a menu in ncurses show
Does anyone know whether it is possible to make rewrite rules which use the
Does anyone know whether it is possible (theoretically or in reality) to use the
Does anyone know whether it is possible to programmatically determine the dimensions of the

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.