当前位置: 代码迷 >> Android >> 请帮见见:为什么已设置: android:layout_height="match_parent" 但ListView还是不会自动充满足ScrollView
  详细解决方案

请帮见见:为什么已设置: android:layout_height="match_parent" 但ListView还是不会自动充满足ScrollView

热度:103   发布时间:2016-04-28 06:20:10.0
请帮看看:为什么已设置: android:layout_height="match_parent" 但ListView还是不会自动充满足ScrollView ?
代码如下,ScrollView已经填充了屏幕上空余的部分,但是ListView却只是显示两行Item的高度,不能填充满ScrollView:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:orientation="vertical" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
         <Button
                android:id="@+id/btnStartDate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_weight="1"  />
         <TextView
                android:id="@+id/textView2"
                android:padding="3dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="center"
                android:text=" 至 " 
                android:layout_weight="0.00" />
          <Button
                android:id="@+id/btnEndDate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_weight="1"  />
    </LinearLayout>

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="1"
        android:layout_weight="0.11" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:text="收入合计:" />

<TextView
    android:id="@+id/lblIncome"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="left"
    android:textColor="#0000ff"
    android:text="" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
            <TextView
                android:id="@+id/textView1"
  相关解决方案