0

right now i have a list view that populates like

[top]
1
2
3
4
[bottom]

I want it to populate like

[top]
4
3
2
1
[bottom]

. android:stackFromBottom="true" is not giving me what i want

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
Wildblue09
  • 337
  • 1
  • 3
  • 13

2 Answers2

1

override getItem and instead of returning the data set entry at position, return the entry at dataset.size() - position - 1. E.g

Assuming the dataset is composed of Strings, and you are storing those in an ArrayList<String>() called mDataSet

 @Override
 public String getItem(int position) {
    return mDataSet.get(dataset.size() - position - 1);
 }
Blackbelt
  • 156,034
  • 29
  • 297
  • 305
1

Refer to this: Is it possible to make a ListView populate from the bottom?

It only works if the ListView's width and height are set to match_parent or fill_parent.

Community
  • 1
  • 1
Koszuta
  • 37
  • 7