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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:57:51+00:00 2026-06-15T05:57:51+00:00

I have a TableLayout with a number of TableRows. Each row contains two TextViews

  • 0

I have a TableLayout with a number of TableRows. Each row contains two TextViews laid out horizontally. The TextViews have fixed widths. The background of each is colored differently; the left is grey and used as a label, and the right is white and contains a value. However, the content of both is dynamic. For any given row, the content of either might be large enough to warrant wrapping to a new line.

Because the backgrounds are colored differently, I need each TextView to match its parent row in order for the colors to fill the view correctly. However, if I set a TextView’s layout_height to match_parent then the TextView doesn’t wrap to a newline if the content is large. In the following screenshot, there is more to the labels than just the first word that is shown:

screenshotOne

On the other hand, if I set a TextView’s layout_height to wrap_content, then if the sibling TextView’s height is larger (and therefore the TableRow’s height), then the first TextView’s background doesn’t fill the space created:

screenshotTwo

So, I want both TextView’s in a TableRow to wrap to a newline if necessary, but also for the backgrounds of each to fill the space in the TableRow at all times.

  • 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-15T05:57:52+00:00Added an answer on June 15, 2026 at 5:57 am

    I found a solution to my problem:

    1. I set the background of each TableRow to the gray (label) color, and gave it the bottom border.
    2. I left the label TextViews’ backgrounds blank, defaulting them to the TableRows’ gray background.
    3. I set the backgrounds of the value TextViews to be white, overlaying the TableRows’ background, but the borders can still be seen.
    4. I set the label TextViews’ layout_width and layout_height to wrap_content
    5. I set the value TextViews’ layout_width to wrap_content, but their layout_height to match_parent

    This worked for every row except the email, where the value always took up more space than the label. So for that particular row I changed the layout_height of the value TextView to wrap_content.

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

Sidebar

Related Questions

Basically I have a TableLayout with several TableRows, each containg 5 cells (Name, Price,
I have a TableLayout and some unknown number of TableRows that are generated based
I have created a Table layout with a number of rows and each row
I have a dynamically inflated layout. <TableLayout> <!-- Two more tablelayout here --> <ScrollView>
I have a Button that adds a row with an EditText to a TableLayout
I have a ListView which I've created a custom view for each row. My
Some Background I have a TableLayout with 9 rows. I chose the TableLayout because
I have a TableLayout and I'm adding rows dynamically. And in every row, I
I have two TableLayout widgets, created programatically in my Activity's onCreate() method. Table1: SomeTextCell1
I have a TableLayout defined in my xml with three columns and four rows

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.