繁体   English   中英

伸出android tablelayout

[英]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_height="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>

我的问题是3个按钮的伸展方式不同。 我知道,由于第一个按钮下面的textview会被拉伸,但是我想知道是否有什么方法可以使按钮保持相同的宽度并仍然保留textview的存在。

将xml属性android:layout_weight="1"用于所有textview。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM