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?
4 Answers
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.
-
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
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
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
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>