views:

356

answers:

2

Android: How to Add Static row in list view I have a requirement where i need to add the Static row as first row in list view

Thanks in advance for help..

+2  A: 

See ListView.addHeaderView(android.View.View).

You can add static headers and footers this way.

synic
That's not strictly true. They are part of the list and scroll with the list contents. Since the person asking the question has not defined what a "static row" is, it is tough to say if `addHeaderView()` will fit the need. If the goal is a static header, something that does not scroll with the list, you just have to put it outside of the `ListView`.
CommonsWare
Thanks for the comment. I also got confused with view added with addHeaderView being scrolled out of screen.
Samik R.
A: 

If you don't want it to scroll along with the ListView, then place a separate view before the ListView. Might go like this:

<include layout="@android:layout/simple_list_item_1" android:id="@+id/header"/>
alex