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 headervie
I'm not sure I correctly understand what you ask. So I get you have something like.
<ListView>
<Header />
<Item />
<Item />
<Item />
</ListView>
Why don't you do
<Header />
<ListView>
<Item />
<Item />
<Item />
</ListView>
?
Instead of adding a Header view add the view directly to the layout above the list view. I had implemented all my list view like this all of them work grt..
For me it worked fine when i included a tag called <include>
before my listview,
the code was something like this
<include layout="@layout/stationlist_header"/>
<ListView
android:id="@+id/mylist"
android:layout_width="match_parent"
android:layout_height="210dp"
android:layout_gravity="bottom"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
</ListView>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@+id/title_top_refine_search" android:layout_width="fill_parent"
android:layout_height="45dip"
android:src="@drawable/title_bar_top"
android:scaleType="fitXY"
android:layout_alignParentTop="true" >
</ImageView>
<TextView android:id="@+id/TextView01" android:textColor="#FFFFFF" android:layout_marginTop="5dip"
android:textStyle="bold" android:gravity="center" android:textSize="23dip"
android:text="Refine Search" android:layout_width="fill_parent" android:layout_height="wrap_content"></TextView>
<ListView android:id="@+id/ListView01"
android:layout_below="@+id/title_top_refine_search"
android:layout_alignParentBottom="true"
android:layout_height="fill_parent"
android:layout_width="fill_parent"> </ListView>
</RelativeLayout>
A Layout Sample Containing header view and List view below
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>
Important things to notice:
@android:id/list
in order to be able to use a ListActivity