Android custom ListView to implement contact sorting

Android custom ListView to implement contact sorting

Source code introduction

Android custom LISTVIEW realizes the effect of contact sorting, which is convenient to use.

Source code running screenshot

Source code snippet

  1. @Override  
  2. public View getLetterView( int position, View convertView, ViewGroup parent) {
  3. // Here is the item interface setting for letters.  
  4. if (convertView == null ) {
  5. convertView = new TextView(MainActivity. this );
  6. ((TextView) convertView).setGravity(Gravity.CENTER_VERTICAL);
  7. convertView.setBackgroundColor(getResources().getColor(android.R.color.white));
  8. }
  9. ((TextView) convertView).setText(list.get(position).getValue());
  10.   
  11. return convertView;
  12. }
  13.   
  14. @Override  
  15. public View getContainerView( int position, View convertView, ViewGroup parent) {
  16. // Here are the item interface settings for other normal data.  
  17. if (convertView == null ) {
  18. convertView = new TextView(MainActivity. this );
  19. ((TextView) convertView).setGravity(Gravity.CENTER_VERTICAL);
  20. }
  21. ((TextView) convertView).setText(list.get(position).getValue());
  22.   
  23. return convertView;
  24. }

Source code link: http://download..com/data/1968342

<<:  bmob personal lost property application_app development template

>>:  Android-menudrawer-master open source powerful sidebar menu

Recommend

45° Angle Law: The unspoken rules of brand, platform and IP

There are always various unspoken rules in the wo...

Yan Yunjia's 12 Lectures on Hot Money Techniques

Yan Yunjia's 12 Lectures on Speculative Capit...

Implementing HttpServer on Android

In a recent project, because Android is used as a...

New ways of Internet marketing and promotion in 2019!

With the advent of the Internet era, the Internet...

2019 Pinduoduo Product Operation Analysis Report

Pinduoduo has rapidly grown into the third larges...

Android opens two paths for two "billion users"

[[121580]] In Q2 2014, Android's market share...

You'd never guess that plants can...

If we fast-forward a video of a plant's growt...

Is Internet advertising burning too much money? You need to know these 5 points

Advertising is not just about spending money. Wha...

A beginner's guide to bird language: Do birds know what they are saying?

© Knowable Magazine Leviathan Press: It is precis...

Long March 6A: my country's first solid-liquid carrier rocket

Friends who are familiar with foreign launch vehi...