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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:02:08+00:00 2026-05-28T06:02:08+00:00

I am working on icon based main menu for my Android application (see attached

  • 0

I am working on icon based main menu for my Android application (see attached image – Google+). The obvious layout for this is a TableLayout.

Google+ Android App

However, I have no idea and could not find information on how to center the table itself and the icons inside. The code I came up with is as follows (and resulting image is below the code):

<TableLayout android:layout_width="fill_parent" android:id="@+id/tableLayout1" android:layout_height="fill_parent" android:stretchColumns="1" android:padding="20dp">
    <TableRow android:id="@+id/tableRow1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="20dp"  >
        <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></Button>
        <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></Button>
    </TableRow>
    <TableRow android:id="@+id/tableRow2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="20dp" >
        <Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" ></Button>
        <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></Button>
    </TableRow>
</TableLayout>

TableLayout

I will appreciate any tips and ideas.

  • 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-28T06:02:09+00:00Added an answer on May 28, 2026 at 6:02 am

    i just made a program main menu like you need. It’s density-independent, but i put it on a scrollview just to make sure it’s usable everywhere.
    You can change the buttons to imagebuttons if you like, so you get the menu you want.

    A little explanation to the code:

    • every row has a textview on the left and on the right, as placeholders. The tablelayout’a android:stretchColumns=”0,3″ stretchs the textviews to fill the space next to the buttons.
    • you can change the margins so the buttons are nearer or further from each other.

    And now here’s the xml:

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TableLayout android:layout_gravity="center" 
            android:layout_width="match_parent" android:layout_height="match_parent"
            android:stretchColumns="0,3">
            <TableRow android:layout_gravity="center">
                <TextView />
                <Button android:text="1" android:layout_margin="15dp"
                    android:layout_gravity="center_vertical"
                    android:width="100dip" android:height="100dip" />
                <Button android:layout_gravity="center_vertical" 
                    android:text="2" android:layout_margin="15dp"
                    android:width="100dip" android:height="100dip" />
                <TextView />
            </TableRow>
    
            <TableRow android:layout_gravity="center">
                <TextView />
                <Button android:text="3"  android:layout_margin="15dp"
                    android:layout_gravity="center_vertical"
                    android:width="100dip" android:height="100dip" />
                <Button android:text="4"  android:layout_margin="15dp"
                    android:layout_gravity="center_vertical"
                    android:width="100dip" android:height="100dip" />
                <TextView />
            </TableRow>
    
            <TableRow android:layout_gravity="center">
                <TextView />
                    <Button android:text="5"  android:layout_margin="15dp"
                    android:layout_gravity="center_vertical"
                    android:width="100dip" android:height="100dip" />
                <Button android:text="6"  android:layout_margin="15dp"
                    android:layout_gravity="center_vertical"
                    android:width="100dip" android:height="100dip" />
                <TextView />
            </TableRow>
        </TableLayout>
    </ScrollView>
    

    And this is how it looks like:
    http://db.tt/yQ5NFhmk

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

Sidebar

Related Questions

I'm trying to create a dynamic icon menu for my android application. The icon
i am working on displaying an image and placing an icon on top of
I have been working on ipad application. In this application I have several views.
I'm working on the toolbar for a WPF application. The icon set we are
I am working on a .NET C# application that has a main Form which
I am working with navigation based application. Every cell creates a detailView. i have
I am working on my first android project. i am doing a maos based
I added a notification icon to my dialog based application, and it received WM_LBUTTONDBLCLK
The only way I've been able to get this working is with a document-based
I'm working on a mechanism to change and items Icon based on a check

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.