Inverted ListView in Android?

霸气de小男生 提交于 2019-11-28 12:11:54
android developer

inside the baseAdapter, for the getView() method , instead of getting the item in the data in index "position" , use the opposite , meaning : numberOfItems minus the position .

as for showing the number of items , that's also inside the baseAdapter : set the value returned by getCount() to be the one you wish it to be (20 in your example,though 80-100 implies that it should be 21 ) .

btw, it seems you are a starter in the case of listView . may i suggest watching this video: http://www.youtube.com/watch?v=wDBM6wVEO70

also check the api-demos provided by the sdk manager . they have plenty of examples there.

Use this getItem Method inside your Adapter for reverse order:

@Override
public Object getItem(int position) {
   return super.getItem(super.getCount() - position - 1);
}

This code is worked for me when pulling data from database.

cs.moveToPosition(super.getCount() - position - 1); //cs is Cursor

Query for records using BETWEEN keyword seems like the easiest solution to me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!