The issue is that the table I am making extends itself off the right
side of the dialog window.

It seems like it only does this when one of the components in the
table is a textview with enough text to cover multiple lines.

Someone suggested that I try using a gridview instead of a table
layout but everything seems so similar between the two and I don't see
why mine does not work.

The gist of the xml is that I am setting up tables inside my vertical
linearlayout that is going in a dialog window.  The tables are set up
with wrap_content for height and fill_parent for width.  Each table is
one row and the row has a button and a textview.  I want the textview
to stretch to take whatever space the button does not take.  When the
button comes first the textview goes beyond the right edge of the
screen.  When the textview comes first it takes the entire screen
width and pushes the button off the screen.  It seems like the
tablelayout believes its parent is wider than it actually is.

Can someone tell me what I am doing wrong?

Here is the XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:orientation="vertical"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    >
    <!-- TABLE WHERE THE TEXTVIEW COMES FIRST -->
    <TableLayout
        android:id="@+id/parcelinfo_moveout_table"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_gravity="center"
        android:stretchColumns="0"
        >
        <TableRow>
            <TextView
                android:id="@+id/moveout_army"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:text="@string/moveout_text"
            />
            <Button
                android:id="@+id/moveout_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dip"
                android:text="@string/moveout_button"
            />
        </TableRow>
    </TableLayout>
    <!-- TABLE WHERE THE BUTTON COMES FIRST -->
    <TableLayout
        android:id="@+id/parcelinfo_movein_table"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_gravity="center"
        android:stretchColumns="1"
        >
        <TableRow>
            <Button
                android:id="@+id/movein_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dip"
                android:text="@string/movein_button"
            />
            <TextView
                android:id="@+id/movein_army"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:text="@string/movein_text"
            />
        </TableRow>
    </TableLayout>
    <TextView
        android:id="@+id/notpresent_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/text_red"
        android:layout_marginTop="15dip"
        android:text="@string/parcelinfo_notpresent"
    />
    <TableLayout
        android:id="@+id/parcelinfo_buttontable"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_gravity="center"
        android:stretchColumns="*"
        >
        <TableRow>
            <Button
                android:id="@+id/parcelinfo_attack_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dip"
                android:text="@string/attack"
            />
            <Button
                android:id="@+id/parcelinfo_close_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dip"
                android:text="@string/close"
            />
        </TableRow>
    </TableLayout>
</LinearLayout>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to