0

The usual thing when I insert a new row into a ListView it is added at the bottom of the ListView by default. Can I make it upside down? I want the new added rows be on top, or I may say I want the ListView in descending flow sorted by time. Is there a way to implement that from ListView settings? or it is related to the List connected with the ListView? I searched about it and all I could find is "stackFromBottom" which makes the view of ListView scroll down and start showing from the bottom, and it is different from what I want.

Zoe
  • 27,060
  • 21
  • 118
  • 148
akhka
  • 1
  • 2

2 Answers2

0

you can add row to top using add function with index.

example :

items.add(0, obj)

inside adapter you have item list that you add the row to top(index 0) and call

notifyiteminserted or notifydatasetchanged

probably duplicated Add new items to top of list view on Android?

mackbex
  • 69
  • 4
0

You can do it in several way

1.You can use Collections Feature. After add item in your List then call Collections.reverse() then update your ListView

2.You can set your List to add(0,value) 0 no position then update your ListView

Tariqul Islam
  • 680
  • 6
  • 14