I have a listactivity which contains a listview. i want to show another layout which contains a button at top and a webview at bottom on this listview and that layout always to be shown. I tried this but this is not what i want to do :
ListView lv =getListView();
LayoutInflater inflater = getLayoutInflater();
ViewGroup header = (ViewGroup)inflater.inflate(R.layout.mylayer, lv, false);
lv.addHeaderView(header, null, false);
This shows my layout but when i scroll my listview, needless to say that when i scroll my listview down it is no more to be shown like it is part of my other listview items.
When using
ListActivity, you can use any layout you want. The only contract you must follow is putting aListViewwhose id islist. Thus, you can do something like:If you do want to reuse another layout, change the
TextViewfor something like<include>(take a look at this article).