45

I have a simple application which basically consists of a line of buttons and a ListView of items to be selected and manipulated. There might be only one item in the list or a few. However, I would prefer if the list would populate from the bottom of the ListView, since the way most people hold their phones makes it easier to select items closer to the bottom of the screen. Is this possible?

osweetman
  • 599
  • 1
  • 4
  • 7

4 Answers4

125

You can have the ListView stack its items from the bottom up using a simple XML property under the xml -

<ListView 
    android:stackFromBottom="true"
...
></ListView>

Please read @The Berga answer to otherwise this won't work.

VVB
  • 7,363
  • 7
  • 49
  • 83
Joe
  • 2,252
  • 1
  • 22
  • 32
  • i want to show list from top to bottom, and you answer helped me alot i get the idea from where i can changed it.. Thnks man... – robinHood013 Nov 30 '15 at 12:03
19

Joe answer is correct but it's important to point out that it only works if the ListView's width and height are set to match_parent or fill_parent.

If set to wrap_content it still will populate from top to bottom.

The Berga
  • 3,744
  • 2
  • 31
  • 34
0

I tried android:stackFromBottom="true" with android:layout_width="match_parent" android:layout_height="fill_parent" but it didn't work

finally

  Adapter.insert(post,0);

saved my day. Here post is the class which is returning data to be added

0

These are a must tags for the reverse populating of the list view.

<ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:stackFromBottom="true"
</ListView>