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?

2
  • what exactly you want. if im not wrong suppose you have three items 1,2,3 then your list with must comtain 3,2,1 thats it or not Apr 3, 2012 at 5:07
  • You wanna display your content from bottom in listivew, is it?
    – RobinHood
    Apr 3, 2012 at 5:22

4 Answers 4

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.

1
  • 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... Nov 30, 2015 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.

1
  • 1
    Upvoted. Good one. Better to edit @Joe answer by yours
    – VVB
    Oct 5, 2015 at 8:41
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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.