代码之家  ›  专栏  ›  技术社区  ›  neu242

如何使按钮成为可滚动列表视图的一部分?

  •  1
  • neu242  · 技术社区  · 14 年前

    我有一个列表视图,下面有一个按钮。当我用超过屏幕大小允许的内容填充列表时,滚动条出现,按钮不在可滚动区域内。也就是说,按钮消失了。如何使按钮成为可滚动区域的一部分?

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
        <ListView android:id="@+id/ListView" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:layout_above="@+id/AddButton" />
    
        <Button android:id="@+id/AddButton" android:layout_width="fill_parent" 
            android:layout_height="wrap_content" android:text="@string/add_title" />
    </RelativeLayout>
    
    2 回复  |  直到 14 年前
        1
  •  2
  •   ognian    14 年前

    将其添加到ListView中 footer .

        2
  •  2
  •   Robby Pond    14 年前

    加上 addFooterView() . 这样,当ListView仍在滚动时,它将始终显示在屏幕底部。

    推荐文章