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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:02:30+00:00 2026-06-15T02:02:30+00:00

I am having two table rows in one of my activity. First row will

  • 0

I am having two table rows in one of my activity. First row will always contains 2 textview and second might contains one or two textview (it depends on userinput). Whenever I am having one textview in 2nd row, I tried to span it to two columns. I am trying something this

TableRow.LayoutParams param = (LayoutParams)editText.getLayoutParams();
param.span = 2;
txtView.setLayoutParams(param);

But its not working. What happens is, second txtview in first row is pushed out of the screen. So can anyone here tell where i am making mistake?

  • 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-06-15T02:02:32+00:00Added an answer on June 15, 2026 at 2:02 am

    I made this example, hope it helps you.

     TableLayout table = (TableLayout)findViewById(R.id.table_id_in_xml);
        TableRow row = new TableRow(this);
        TableRow row2 = new TableRow(this);
        TextView col1, col2, col3;        
    
        row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
        row2.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
    
        col1 = new TextView(this);
        col2 = new TextView(this);
        col3 = new TextView(this);
    
        col1.setText("col1");
        col2.setText("col2");
        col3.setText("col3");
    
        row.addView(col1);
        row.addView(col2);
        row.addView(col3);
    
        table.addView(row, new TableLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    
        //HERE IS WHAT YOU NEED
        TableRow.LayoutParams params = (TableRow.LayoutParams) row2.getLayoutParams();
        params.span = 3; //amount of columns you will span
    
        col1 = new TextView(this);
    
        col1.setText("span on col1 makes it bigger than the others");
        col1.setLayoutParams(params);
        row2.addView(col1);
    
        table.addView(row2, new TableLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my html table I have two row, first row having no css but
I have one table CSBCA1_5_FPCIC_2012_EES207201222743 , having two columns employee_id and employee_name I have
I have two tables. I am trying to find rows in one table which
I Using Two Table User And Location In User Table I having LocationId And
I'm having the following two tables... Table : room_type type_id type_name no_of_rooms max_guests rate
I am having a table named as goal , inside that there are two
I'm having trouble with Access, when joining two tables where one of the join
Having one table with users (which are registered) in mysql I simply want to
I'm having a table row selection problem with JXTable. If I run the following
Actually having two listviews with scrollbars, one of the listview is not scrolling it.

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.