我有一个列表视图,在那里我加入headerview到该列表。每一件事情很好,但是当我滚动列表headerview也与列表移动,所以我想避免headerview滚动,我的意思是我必须滚动只有当我列出达到冠捷(标题栏)列表,headerview必须保持标题栏的底部。
I have a list view , where i am adding headerview to that list . every thing fine , but when am scrolling list headerview also moving with list, so i want to avoid headerview scrolling , i mean i have to scroll only list when i list reached to topview (titlebar), headerview has to remain bottom of titlebar .
任何一个可以给我一个解决方案?
can any one gimme a solution for this ?
一个头,而不是使用下面的布局:
Instead of a header use the following layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
--> Your header layout here
</LinearLayout>
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" />
</LinearLayout>
重要的事情需要注意:
ListView控件的ID必须是 @android:ID /列表
,以便能够使用ListActivity
使用一个0高度,并设置权重为1
The id of the ListView must be @android:id/list
in order to be able to use a ListActivity
Use a 0 height and set the weight to 1