开发者

stretched out android tablelayout

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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:orientation="vertical" android:background="@drawable/background"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:layout_gravity="center">

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:orientation="horizontal"
        android:layout_marginBottom="50dp">

        <TableLayout android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:layout_marginTop="15dp">

            <TextView android:gravity="center" style="@style/entsweep_h_Font"
                android:text="numbers" android:id="@+id/entsweep_head_tv">
            </TextView>

            <TableRow android:layout_width="fill_parent"
                android:layout_heigh开发者_如何学Pythont="wrap_content" android:gravity="center"
                android:layout_marginTop="10dp">

                <TextView android:layout_width="75dp" android:gravity="center"
                    android:layout_height="wrap_content" android:text="20" android:id="@+id/ent_submit"
                    style="@style/entsweep_Button" android:layout_marginRight="10dp">
                </TextView>

                <TextView android:layout_width="75dp" android:gravity="center"
                    android:layout_height="wrap_content" android:text="50" android:id="@+id/ent_submit"
                    style="@style/entsweep_Button" android:layout_marginRight="10dp">
                </TextView>

                <TextView android:layout_width="75dp" android:gravity="center"
                    android:layout_height="wrap_content" android:text="100"
                    android:id="@+id/ent_submit" style="@style/entsweep_Button">
                </TextView>

            </TableRow>

            <TableRow android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:gravity="center"
                android:layout_gravity="center">

                <TextView android:gravity="center"
                    android:text="yet."
                    android:layout_height="wrap_content" android:layout_width="wrap_content"
                    android:id="@+id/ent_submit">
                </TextView>

            </TableRow>

        </TableLayout>

    </LinearLayout>

</RelativeLayout>

My problem is the 3 buttons are stretched out differently. I know that because of the textview below the first button would be stretched but I was wondering if there is any way I can make the buttons to stay in the same width and still have the textview exist.


Use the xml attribute android:layout_weight="1" for all the textviews.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜