本文主要是介绍Android开发之仿联系人界面(根据文字首字母A、B、C实现快速索引),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Android开发之仿联系人界面(根据文字首字母A、B、C实现快速索引)
Android手机系统应用中自带的联系人界面中的根据ABCDE等文字的首字母实现快速索引的效果让人眼前一亮,经过本人的研究,已基本实现了其功能,现将代码贴出,望大神们批评指正,非常感谢!
先上效果图:
核心代码如下:
MainActivity
package com.hxht.testquickindex; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import com.hxht.testquickindex.adapter.HeroesAdapter; import com.hxht.testquickindex.domain.Heroes; import com.hxht.testquickindex.mycustomview.QuickIndexBar; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class MainActivity extends Activity {private ListView lv; private QuickIndexBar quickindexbar; private TextView tvShowletter; private List<Heroes> list; private static final String[] names = new String[]{"宋江", "卢俊义", "吴用", "公孙胜", "关胜", "林冲", "秦明", "呼延灼", "花荣", "柴进", "李应", "朱仝", "鲁智深", "武松", "董平", "张清", "杨志", "徐宁", "索超", "戴宗", "刘唐", "李逵", "史进", "穆弘", "雷横", "李俊", "阮小二", "张横", "阮小五", "张顺", "阮小七", "杨雄", "石秀", "解珍", "解宝 ", "燕青", "朱武", "黄信", "孙立", "宣赞", "郝思文", "韩滔", "彭玘", "单廷圭", "魏定国", "萧让", "裴宣", "欧鹏", "邓飞", "燕顺", "杨林", "
这篇关于Android开发之仿联系人界面(根据文字首字母A、B、C实现快速索引)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!