Is it possible to have an index on the righthand side of a ListView? This is possible on the iPhone where running down the righthand side the alphabet is shown. Touching a letter on the alphabet brings one to the beginning of the items in the ListView that start with that letter.
Is there built-in code in Android for this functionality? Or is this something one would have to custom make?
It's worth to mentioned that the ListView is a kind of deprecated because the RecyclerView was introduced with the API 21 (Android Lollipop).
Simple answer: You should use RecyclerView in a situation where you want to show a lot of items, and the number of them is dynamic. ListView should only be used when the number of items is always the same and is limited to the screen size.
xml. Create an another layout file (list_row. xml) in /res/layout folder to show the data in listview, for that right click on layout folder à add new Layout resource file à Give name as list_row.
There is no exactly what you want. There is a very similar thing. First set fast scroll mode of your ListView:
ListView.setFastScrollEnabled(true);
next implement the following Interface by your adapter:
android.widget.SectionIndexer
http://developer.android.com/reference/android/widget/SectionIndexer.html
This way you will be able to scroll fast your ListView with a thumb button.
If you implement SectionIndexer correctly you will be able to see a alphabet letter on which you are currently on during fast scrolling.
Check this one http://hello-android.blogspot.com/2010/11/sideindex-for-android.html .. exactly the same..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With