1
我想添加一個視圖操作頂部的列表視圖(我們稱之爲標題)。當用戶向下滾動時,我希望所有內容向上移動(包括標題)。然而,現在當用戶滾動頭部時,頭部會固定在頂部(如在CSS中的「position:fixed」),而不是滾動其餘內容。在向下滾動時在ListView頂部添加視圖並移動所有內容?
我該如何讓用戶滾動一切,而不僅僅是ListView的內容?
這是我的佈局看起來像現在:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?attr/color2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/header"
style="@style/header"
android:drawableLeft="@drawable/ic_setup"
android:text="@string/fragment_contacts"/>
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"
android:fastScrollEnabled="false">
</ListView>
</LinearLayout>