I am trying to build a list view in android that would look like this (ignore the search-bar):
iPhone has a similar option called as section index :
iphone section index. http://t0.gstatic.com/images?q=tbn:ANd9GcRcssNycAZ6s_vITQaHXwo3A_pDbfGeQImVdPDPiGn5zCMAR4i_
I am able to get the sections within the list by using : http://bartinger.at/listview-with-sectionsseparators/
Now I want to build the index (something that is on the right of the first image) (Index is customized and may contain more than just one alphabet)
I don't want to do it the following way :
create an activity that has one listview on left and another textview(or may be anything) on the right then track the right element and update the list. eg : http://hello-android.blogspot.com/2010/11/sideindex-for-android.html
I want to customize the listview of android itself so that the list view would include such an index at the right . something like this.
A class that extends ListActivity
and the class some or how contains the side-bar.
(I'll manage the coding for the side-bar to work). So whenever another class extends MyCustomListActivity
it will have the list as well as sidebar.
My question is how do I include the side bar in my custom class that is extending the ListActivity ? Or is there a better approach to doing this ?
Before getting into listview example, we should know about listview, Listview is a collection of items pulled from arraylist, list or any databases. Most uses of listview is a collection of items in vertical format, we can scroll up/down and click on any item.
cause my index is not just one letter , in a few cases its multiple letters. – Gaurav Shah 2 days ago
Assuming that's your only reason for not wanting to use Fast Scrolling with SectionIndexer
, here is some code that's designed to work for multiple letters.
Here is a screenshot of what it's supposed to look like:
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