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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:32:25+00:00 2026-06-06T15:32:25+00:00

I created a TableLayout for my application. Everything is working fine, but once I

  • 0

I created a TableLayout for my application. Everything is working fine, but once I add the button image at the bottom of the page the alignment breaks. Here is an image before entering the button image code:

enter image description here

After entering the code for the button images:

enter image description here

My xml layout:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:id="@+id/tableLayout1"  
    android:layout_width="match_parent"  
    android:layout_height="match_parent"  
    android:shrinkColumns="*"  
    android:stretchColumns="*"
    android:background="@drawable/authenticinfo">  
    <TableRow  
        android:id="@+id/tableRow1"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="18dp"              
            android:gravity="center"  
            android:layout_span="6"></TextView>  
    </TableRow>  
      <TableRow  
        android:id="@+id/tableRow2"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView               
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="38dp"              
            android:gravity="center"  
            android:layout_span="6"></TextView>  
    </TableRow>  
        <TableRow  
        android:id="@+id/tableRow3"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/textView2"  
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="38dp"               
            android:gravity="center"  
            android:layout_span="6"></TextView>  
    </TableRow>      
            <TableRow  
        android:id="@+id/tableRow4"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
         <ImageView
            android:id="@+id/imview"            
            android:layout_centerHorizontal="true"          
             android:layout_gravity="center"
            /> 
    </TableRow>  
     <TableRow  
        android:id="@+id/tableRow5"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView              
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="20dp"               
            android:gravity="center"  
            ></TextView>  
    </TableRow>     
             <TableRow  
        android:id="@+id/tableRow6"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/ProductID1"  
            android:text="Product ID"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/ProductID2"  
            android:text=":"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/ProductID3"  
            android:text="92173ad0"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>
    </TableRow>     
             <TableRow  
        android:id="@+id/tableRow7"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/ProductID4"  
            android:text="产品编号 "  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/ProductID5"  
            android:text=":"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/ProductID6"  
            android:text="92173ad0"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>
    </TableRow>     
              <TableRow  
        android:id="@+id/tableRow8"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView               
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="8dp"               
            android:gravity="center"  
            android:layout_span="6"></TextView>  
    </TableRow> 
<TableRow  
        android:id="@+id/tableRow9"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/Manf1"  
            android:text="生产日期  "  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/Manf2"  
            android:text=":"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/Manf3"  
            android:text="01 Jan 2012"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>
    </TableRow> 
<TableRow  
        android:id="@+id/tableRow10"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/Exp1"  
            android:text="有效日期  "  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/Exp2"  
            android:text=":"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/Exp3"  
            android:text="01 Jan 2015"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>
    </TableRow>
    <TableRow  
        android:id="@+id/tableRow11"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView               
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="8dp"               
            android:gravity="center"  
            android:layout_span="6"></TextView>  
    </TableRow>  
    <TableRow  
        android:id="@+id/tableRow12"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/Mas1"  
            android:text="马来西亚出口许可证   "  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/Mas2"  
            android:text=":"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/Mas3"  
            android:text=""  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>
    </TableRow>
     <TableRow  
        android:id="@+id/tableRow13"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView  
            android:id="@+id/China1"  
            android:text="中国的进口许可证   "  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/China2"  
            android:text=":"  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>  
        <TextView  
            android:id="@+id/China3"  
            android:text=""  
            android:textStyle="bold"  
            android:typeface="serif"></TextView>
    </TableRow>    
      <TableRow  
        android:id="@+id/tableRow14"  
        android:layout_height="wrap_content"  
        android:layout_width="match_parent"  
        android:gravity="center_horizontal">  
        <TextView               
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            android:textStyle="bold"  
            android:typeface="serif"  
            android:textSize="28dp"               
            android:gravity="center"  
            android:layout_span="6"></TextView>  
    </TableRow>  


<TableRow  
        android:id="@+id/tableRow15"  
        >  
       <ImageView
            android:id="@+id/imbutt"            
            android:layout_centerHorizontal="true"          
             android:layout_gravity="center"
             android:background="@+drawable/buttonmainmenuoff"
            /> 
            <ImageView
            android:id="@+id/imbutt"            
            android:layout_centerHorizontal="true"          
             android:layout_gravity="center"
             android:background="@+drawable/buttonmainmenuoff"
            /> 
            <ImageView
            android:id="@+id/imbutt"            
            android:layout_centerHorizontal="true"          
             android:layout_gravity="center"
             android:background="@+drawable/buttonmainmenuoff"
            /> 
    </TableRow>

</TableLayout>
  • 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-06T15:32:27+00:00Added an answer on June 6, 2026 at 3:32 pm

    The layout breaks because the ImageViews that you add at the end stretch the columns where they are placed(for example the second ImageView that you add will stretch the TextView that holds the :). You don’t say how you want them placed but one simple thing that you could do is to wrap them in another layout, like LinearLayout like this:

     <TableRow android:id="@+id/tableRow15" >
    
            <LinearLayout
                android:layout_span="6"
                android:gravity="center" >
    
                <ImageView
                    android:id="@+id/imbutt1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/ic_launcher" />
    
                <ImageView
                    android:id="@+id/imbutt2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/ic_launcher" />
    
                <ImageView
                    android:id="@+id/imbutt3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/ic_launcher" />
            </LinearLayout>
        </TableRow>
    

    Of course you could spread them if you want, with the layout_weight attribute.

    As a side note, do you really have 6 columns in your layout(you set the layout_span to 6)? Also , do you use those empty singular TextViews or you just use them as dividers(if this is what you want, then you could consider a simple View element outside the TableRows with the desired height)?

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

Sidebar

Related Questions

In my application I save the contents of a tableLayout as an image in
i have created a login page for some application in android and i want
I was trying to make application, it was working but now when I run
I have created a dynamic TableLayout and I have given an image to TableRow's
I created a project in flex builder with application server type set to none.
I am trying to create a basic datasheet in my application using a TableLayout.
I have a Silverlight application with some maps, and in the same page this
I have created a table (TableLayout) which shows the amount of minutes used calling
i have created following layout. <TableLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal > <TableRow> <TextView android:layout_width=fill_parent android:layout_height=wrap_content
I have created a Table Layout named table and I am trying to add

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.