TableRow不适合屏幕宽度

时间:2018-07-08 10:53:11

标签: android xamarin.android tablelayout tablerow

我正在开发一个xamarin.android应用程序,该应用程序将从数据库填充listview适配器。列表视图条目以带有表行的tableyout形式显示,但表行不适合屏幕的宽度。我为您提供以下axml布局代码:

    <?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:shrinkColumns="*">
    <TableRow>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="@string/bin"
            android:textColor="@color/black"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:gravity="right"
            android:textColor="@color/black"
            android:id="@+id/binValue"
            android:textStyle="bold" />
    </TableRow>
    <TableRow>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="@string/item"
            android:textColor="@color/black"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:gravity="right"
            android:textColor="@color/black"
            android:id="@+id/itemValue"
            android:textStyle="bold" />
    </TableRow>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/black"
        android:id="@+id/itemDescription"
        android:textStyle="bold" />
    <TableRow>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="@string/customer"
            android:textColor="@color/black"
            android:textStyle="bold" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:gravity="right"
            android:id="@+id/custValue"
            android:textColor="@color/black"
            android:textStyle="bold" />
    </TableRow>

</TableLayout>

enter image description here

如何使表格行适合屏幕的宽度?

0 个答案:

没有答案