我想要一个列表视图,并且我的应用程序中有 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 textview 完全消失了。我认为layout_weight越高,视图越小(在width = fill_parent的情况下)。任何帮助表示赞赏。