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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:17:56+00:00 2026-06-02T12:17:56+00:00

I have a TableLayout with 3 rows at present and each row has one

  • 0

I have a TableLayout with 3 rows at present and each row has one child, a TextView. My problem is that the TextViews widths do not "match_parent" as they should. I have followed the procedure of not defining heights and widths for them(like the documentation says) but for some reason the problem is still there.

I have opened up the hierarchyviewer and had a look at the values, the TableRow fills the width as it should but the TextView does not fill the row, it is just wrapping the content. The full xml layout is below, does anybody have any ideas?

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content">   
    <TextView
        android:background="@drawable/textlines"
        android:text="@string/text1_string"
        android:textColor="#000000"
        android:padding="5dp">
    </TextView>
</TableRow>
<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content">   
    <TextView
        android:background="@drawable/textlines"
        android:text="@string/text1_string"
        android:textColor="#000000"
        android:padding="5dp">
    </TextView>
</TableRow>
<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content">   
    <TextView
        android:background="@drawable/textlines"
        android:text="@string/text1_string"
        android:textColor="#000000"
        android:padding="5dp">
    </TextView>
</TableRow>
</TableLayout>

Also I’ll include the xml file for the @drawable/textlines. Perhaps the problem is in there? (The textlines code is taken from a solution provided on here concerning a question about borders) I pretty much understand it and I don’t think it should affect my problem but I could be wrong. Anyway, here it is:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
  <shape 
    android:shape="rectangle">
        <stroke android:width="1dp" android:color="#FF000000" />
        <solid android:color="#FFDDDDDD" />

    </shape>
</item>

<item android:top="1dp" android:bottom="1dp"> 
  <shape 
    android:shape="rectangle">
        <stroke android:width="1dp" android:color="#FFDDDDDD" />
        <solid android:color="#00000000" />
    </shape>
</item>
</layer-list>
  • 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-02T12:18:01+00:00Added an answer on June 2, 2026 at 12:18 pm

    I don’t know why that happens but you could avoid that issue either by adding:

    android:layout_weight="1"
    

    to your children TextViews, or by adding:

    android:stretchColumns="0"
    

    to your parent TableLayout.

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

Sidebar

Related Questions

I have following UI hierarchy Scroll View -->TableLayout-->Rows [each row has TextView+EditText] Problem Inside
I have a layout that contains a TableLayout with three rows. Each row has
I have a TableLayout in the xml that has a row. I am adding
I have a TabLayout. In that I have a tablelayout with dynamically added rows.
I have the following problem spanning dynamically added rows to a TableLayout inside a
I have a TableLayout and I'm adding rows dynamically. And in every row, I
Context: I have a TableLayout (created using XML), which has one TableRow, which has
I have a TableLayout defined in my xml with three columns and four rows
So I have a table layout that Im adding rows to through code since
Basically I have a TableLayout with several TableRows, each containg 5 cells (Name, Price,

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.