0

I have an activity in which I inflate an xml layout (R.layout.listView) that contains a listview (@+id/listview) I want to give a header to that listView, but the header is a complex view from another xml (R.layout.complexView). It has a LinearLayout that groups a ton of TextView, ImageView, etc. Its seems I can't find a way to inflate them both and then run the code

listview.addHeaderView(View view).

What code should I use in my Activity to achieve the desired effect? The goal here is to make my whole view scrollable with my listView (same effect as the Google Maps restaurant details View)

Thanks!

Stephane Maarek
  • 5,202
  • 9
  • 46
  • 87

1 Answers1

0
View headerView = getLayoutInflater().inflate(R.layout.complexView, null, false);
listview.addHeaderView(headerView);

you have to set header view before setting the adapter

Tomislav Novoselec
  • 4,570
  • 2
  • 27
  • 22