Android的:如何避免头从滚动列表视图中的Android? [英] Android : How to avoid header from scrolling in listview , android?
本文介绍了Android的:如何避免头从滚动列表视图中的Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个列表视图,在那里我加入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
这篇关于Android的:如何避免头从滚动列表视图中的Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文