Android : How to populate a ListView with alphabet indexer and fastscroll as in contacts app.?

前端 未结 3 430
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 13:29

I would like to implement a ListView with fastscroll and albhabet indexer as in the contacts application. I\'m using a SimpleAdapter to populate the ListView. As seen from t

3条回答
  •  长发绾君心
    2020-12-30 14:16

    I will let you know in brief.

    Create a class extends RelativeLayout implements OnTouchListener

    Define a strings of alphabets

    Find the screen height of list view

    Create dyanamic textviews count same as number of alphabets, height of textView ==> screenWidth / alphabets.

    Override onTouch method .

    Find the textview which is currently selected//Offset.

    Create a handler for sending the event to mainList

    Call Listview setSelectionFromTop method pass the position.

    Its done...

提交回复
热议问题