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

The Archive Base Latest Questions

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

I want to display 9 buttons in a table, 3 buttons on each row.

  • 0

I want to display 9 buttons in a table, 3 buttons on each row. All the buttons has the same dimensions. Can you tell me please how can I display this table in the middle of the screen?
Is table a solution or I’m on the wrong way?

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent"  
android:layout_gravity = "center_horizontal"

     >  
    <TableRow>  

<ImageButton android:id="@+id/btn1"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="1"  
    android:background="@drawable/xo" 

 />  

<ImageButton android:id="@+id/btn2"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="2"  
 android:background="@drawable/xo" 

 />   
<ImageButton android:id="@+id/btn3"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="3"  
 android:background="@drawable/xo" 


 />  
 </TableRow>  
 <TableRow>  
<ImageButton android:id="@+id/btn4"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="4"  
 android:background="@drawable/xo" 
 />  
<ImageButton android:id="@+id/btn5"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="5"  
  android:background="@drawable/xo" 

 />  
<ImageButton android:id="@+id/btn6"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="6"  
 android:background="@drawable/xo" 

 />  

</TableRow>  
 <TableRow>  
<ImageButton android:id="@+id/btn7"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="7"  
 android:background="@drawable/xo" 

 />  
<ImageButton android:id="@+id/btn8"  
 android:layout_width="60px"   
    android:layout_height="80px"  
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="8"  
  android:background="@drawable/xo" 

 />  
<ImageButton android:id="@+id/btn9"  
 android:layout_width="60px"   
    android:layout_height="80px" 
    android:layout_margin="10px"  
    android:clickable="true"  
    android:tag="9"  
  android:background="@drawable/xo" 

 />  

</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-13T11:15:03+00:00Added an answer on June 13, 2026 at 11:15 am

    Wrap the table in another ViewGroup.

    1. Set the parent’s gravity to ‘center’.
    2. Set the parent’s height and width to “fill_parent”
    3. Set the table’s height and width to “wrap_content”

    Now your table will be centered inside another Layout that takes up the whole screen.

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:gravity="center">
    
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"  
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"  
    
         >  
        <TableRow>  
    
    <ImageButton android:id="@+id/btn1"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="1"  
        android:background="@drawable/xo" 
    
     />  
    
    <ImageButton android:id="@+id/btn2"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="2"  
     android:background="@drawable/xo" 
    
     />   
    <ImageButton android:id="@+id/btn3"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="3"  
     android:background="@drawable/xo" 
    
    
     />  
     </TableRow>  
     <TableRow>  
    <ImageButton android:id="@+id/btn4"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="4"  
     android:background="@drawable/xo" 
     />  
    <ImageButton android:id="@+id/btn5"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="5"  
      android:background="@drawable/xo" 
    
     />  
    <ImageButton android:id="@+id/btn6"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="6"  
     android:background="@drawable/xo" 
    
     />  
    
    </TableRow>  
     <TableRow>  
    <ImageButton android:id="@+id/btn7"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="7"  
     android:background="@drawable/xo" 
    
     />  
    <ImageButton android:id="@+id/btn8"  
     android:layout_width="60px"   
        android:layout_height="80px"  
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="8"  
      android:background="@drawable/xo" 
    
     />  
    <ImageButton android:id="@+id/btn9"  
     android:layout_width="60px"   
        android:layout_height="80px" 
        android:layout_margin="10px"  
        android:clickable="true"  
        android:tag="9"  
      android:background="@drawable/xo" 
    
     />  
    
    </TableRow>    
    </TableLayout>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display multi-buttons alertview to user everyday twice a day. They can
I want to display all the possible enum values as Radio buttons. I am
I want to create a table which displays in each row a set of
I have multiple table rows that has a set of radio buttons on each
I have a table full of radio buttons. Each one has a name and
In My HTML Page I want to display certain Number of Buttons Based on
I have a map ` { key1=[button1,button2,button3,button4],key2=[button1],key3=[button1,button2],key4=[button1,button2,button3]} ` i want to display this map
I have a delete button in each row of GridView (component ASP.NET). I want
I want to create a table representing data I have, but I want each
I'm trying to use jQuery with JSP to display a table where in each

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.