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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:21:17+00:00 2026-05-30T21:21:17+00:00

I’ve been trying to create a simple layout. It’s a 3×3 grid with a

  • 0

I’ve been trying to create a simple layout. It’s a 3×3 grid with a TextView below.
I use a TableLayout to set the ImageButtons and the TextView(TextView has layout_span=3).
The problem is that in Landscape mode i can’t see the TextView.

I’ve tried to put some weights to the TableRows but this fixes the problem of the Landscape mode creating an other problem: in portrait mode there are huge spaces between the buttons.

What I’m trying to create is a tick tack toe game, so I’d like the buttons to be compact.

How can I obtain such an effect? I want the Textview to take all the vertical space remaining, and I want it to be visible even in Landscape mode.

Any solution for this?

This is the xml code:

<?xml version="1.0" encoding="utf-8"?>

<!--suppress AndroidDomInspection -->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:background="#000000"
              android:stretchColumns="*">
    <TableRow android:layout_margin="2dip"
              android:background="#000000">
        <ImageButton android:id="@+id/z_z" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
        <ImageButton android:id="@+id/z_o" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
        <ImageButton android:id="@+id/z_t" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
    </TableRow>
    <TableRow android:layout_margin="2dip"
              android:background="#000000">
        <ImageButton android:id="@+id/o_z" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
        <ImageButton android:id="@+id/o_o" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
        <ImageButton android:id="@+id/o_t" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
    </TableRow>
    <TableRow android:layout_margin="2dip"
              android:background="#000000">
        <ImageButton android:id="@+id/t_z" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
        <ImageButton android:id="@+id/t_o" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
        <ImageButton android:id="@+id/t_t" android:layout_margin="3dip"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:src="@drawable/empty"
                     android:background="#ffffff"/>
    </TableRow>
    <TableRow>
        <TextView android:id="@+id/message_txt_view"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/how_to_play"
                  android:textSize="@dimen/message_size"
                  android:layout_span="3"/>

    </TableRow>

</TableLayout>

EDIT:
I’ve understood how to use weights, but I think this does not actually resolve my problem, because on different screen sizes the grid is still malformed.
What I really want to do is a way to use the screen size in the layout code.
In this way I could use weights that work for it.

Probably I can specify a different layout for every screen dimension(I read something like this one or two days ago), but this would be a bit boring. And also I’d have tons of file to update if I change the layout.

Maybe there is a way to set the TableLayout height to wrap_content, while having the TextView heights set to fill_parent, taking all the space possible to show the grid?
This would really solve my problem for every screen size.

  • 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-30T21:21:18+00:00Added an answer on May 30, 2026 at 9:21 pm

    Create a different layout for landscape mode using the weights you mention and leave the portrait mode one as is.

    To use it simply name the two layouts the same. Put the portrait one in the usual “layout” directory and put the landscape one in a new directory “layout-land”.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported

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.