0

リストビューが必要で、アプリに header.xml と row.xml ファイルがあります。どちらも線形レイアウトで、6 つの子テキストビューがあります。最初のテキストビューは ID であり、ユーザーにとって重要ではないため、最小化したいと思います (まだ表示されています)。

コード (header.xml):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    android:paddingBottom="6dip"
    android:paddingTop="4dip" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:text="ID"
        android:textSize="12dp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Date"
        android:textSize="12dp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="time"
        android:textSize="12dp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Food"
        android:textSize="12dp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Rating2"
        android:textSize="12dp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Rating"
        android:textSize="12dp" />

</LinearLayout>

問題は、ID テキストビューが完全に消えてしまったことです。私は、layout_weightが高いほど、ビューが小さくなると思いました(width = fill_parentの場合)。どんな助けでも大歓迎です。

4

1 に答える 1

0
<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:text="ID"
        android:textSize="12dp"
        android:visibility="invisible"/>

だから追加android:visibility="invisible"

于 2012-07-22T23:59:46.433 に答える