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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:06:36+00:00 2026-05-20T16:06:36+00:00

In the layout below I expect the rows to have exact heights first row

  • 0

In the layout below I expect the rows to have exact heights first row 178px and the next two of 71px. Instead I am getting the bottom two with a few extra pixels. What am I doing wrong or is the tablelayout just not as precise as I like?

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="480px"
    android:layout_height="320px"
    android:background="@drawable/screen"
    android:padding="0dp"
    android:layout_margin="0dp"
    android:stretchColumns="0"
    android:weightSum="320" >
    <TableRow android:layout_weight="178" android:padding="0dp" android:layout_margin="0dp">
        <TextView
          android:text=""
          android:gravity="center_horizontal"
          android:background="#99aa0000"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:padding="0dp"
           />
    </TableRow>
    <TableRow android:layout_weight="71" android:padding="0dp" android:layout_margin="0dp">
        <TextView
          android:text=""
          android:gravity="center_horizontal"
          android:background="#990000aa"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:padding="0dp"
          android:layout_margin="0dp" />

    </TableRow>
    <TableRow android:layout_weight="71" android:padding="0dp" android:layout_margin="0dp">
        <TextView
          android:text=""
          android:gravity="center_horizontal"
          android:background="#9900aa00"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:padding="0dp"
          android:layout_margin="0dp"
          />
    </TableRow>
</TableLayout>
</blink> 
  • 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-20T16:06:37+00:00Added an answer on May 20, 2026 at 4:06 pm

    The layout_height for the TableRows did not affect it either, it seems in 3.0 the TableLayout works as expected but older versions are weird. A friend suggested I try similar approach with LinearLayout and it actually worked:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="480px"
        android:layout_height="320px"
        android:background="#99ff0101"
        android:padding="0dp"
        android:layout_margin="0dp"
        android:weightSum="320"
        android:orientation="vertical" >
            <TextView
              android:text=""
              android:background="#99aa0000"
              android:layout_width="fill_parent"
              android:layout_height="0px"
              android:padding="0dp"
              android:layout_weight="178"
               />
            <TextView
              android:text=""
              android:background="#990000aa"
              android:layout_width="fill_parent"
              android:layout_height="0px"
              android:padding="0dp"
              android:layout_margin="0dp"
              android:layout_weight="71"  />
    
            <TextView
              android:text=""
              android:background="#9900aa00"
              android:layout_width="fill_parent"
              android:layout_height="0px"
              android:padding="0dp"
              android:layout_margin="0dp"
              android:layout_weight="71" 
              />
    </LinearLayout >
    

    As for the exact pixel dimensions, I am fully aware its not recommended, I was just testing how the rows are scaling and using it as an example to display my problem.

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

Sidebar

Related Questions

I have a listView with custom objects defined by the xml-layout below. I want
Below is the code of a simple html with a table layout. In FF
What java GUI layout manager does everyone use? Lately, I have been using MigLayout
I have a layout which uses min-width and works great. So I came to
With the below code, nothing appears in the ListActivity as I would expect. No
Linear layout below. This layout is aligned parent bottom in a Relative Layout. Problem
Let me explain the basic layout below: |----------------------------| | title banner | | |
I have now seen different elegant ways to layout code on this forum. As
I am developing an android app whose relative layout is given below. Here is
I've got a layout much like the one below. Currently when the back button

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.