0

I know that is not a good practice put a ListView inside a ScrollView, that's why I want to figure out what kind of solution can handle this.

Look at the image below:

enter image description here

There's a block with some stuff on the top and there's a ListView below, and all of this scrolls with the entire layout. So, the question is:

How do I achieve this?

Rodrigo Salles
  • 257
  • 1
  • 2
  • 9

3 Answers3

2

You should have just a ListView and set a headerView to this ListView to achieve what you want.

Aurélien Guillard
  • 1,203
  • 8
  • 20
  • God, so simple!! Thank you very much!! If anyone wants the code, here it is: [http://stackoverflow.com/questions/7838921/android-listview-addheaderview-nullpointerexception-for-predefined-views/7839013#7839013](http://stackoverflow.com/questions/7838921/android-listview-addheaderview-nullpointerexception-for-predefined-views/7839013#7839013) – Rodrigo Salles Jul 24 '14 at 16:20
1

Use header View: ListView below scrollview in Android

or Sticky List Headers if you want to make them stick on top of the listview: https://github.com/emilsjolander/StickyListHeaders

or use different ViewTypes with your own Adapter implementation: Listview: Only one list item with multiple textviews

Community
  • 1
  • 1
sockeqwe
  • 15,574
  • 24
  • 88
  • 144
0

Why do you assume the reviews shown there are in a ListView? To me they just look like a handful of custom Views stacked on top of each other, not an actual ListView.

Veselin Romić
  • 703
  • 6
  • 11