• 大小: 1.01M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2020-12-27
  • 标签:

资源简介

android联系人带字母检索源码

/**
 * 联系人列表适配器。
 * 
 * @author guolin
 */
public class ContactAdapter extends ArrayAdapter<Contact> {

	/**
	 * 需要渲染的item布局文件
	 */
	private int resource;

	/**
	 * 字母表分组工具
	 */
	private SectionIndexer mIndexer;

	public ContactAdapter(Context context, int textViewResourceId, List<Contact> objects) {
		super(context, textViewResourceId, objects);
		resource = textViewResourceId;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Contact contact = getItem(position);
		LinearLayout layout = null;
		if (convertView == null) {
			layout = (LinearLayout) LayoutInflater.from(getContext()).inflate(resource, null);
		} else {
			layout = (LinearLayout) convertView;
		}
		TextView name = (TextView) layout.findViewById(R.id.name);
		LinearLayout sortKeyLayout = (LinearLayout) layout.findViewById(R.id.sort_key_layout);
		TextView sortKey = (TextView) layout.findViewById(R.id.sort_key);
		name.setText(contact.getName());
		int section = mIndexer.getSectionForPosition(position);
		if (position == mIndexer.getPositionForSection(section)) {
			sortKey.setText(contact.getSortKey());
			sortKeyLayout.setVisibility(View.VISIBLE);
		} else {
			sortKeyLayout.setVisibility(View.GONE);
		}
		return layout;
	}

	/**
	 * 给当前适配器传入一个分组工具。
	 * 
	 * @param indexer
	 */
	public void setIndexer(SectionIndexer indexer) {
		mIndexer = indexer;
	}

}


资源截图

代码片段和文件信息

/** Automatically generated file. DO NOT MODIFY */
package com.example.contactsdemo;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        356  2013-04-02 20:52  ContactsDemo\.classpath

     文件        815  2013-04-02 20:52  ContactsDemo\.project

     文件        979  2013-04-02 21:06  ContactsDemo\AndroidManifest.xml

     文件        979  2013-06-07 20:18  ContactsDemo\bin\AndroidManifest.xml

     文件        357  2013-06-07 20:18  ContactsDemo\bin\classes\com\example\contactsdemo\BuildConfig.class

     文件        737  2013-06-07 20:18  ContactsDemo\bin\classes\com\example\contactsdemo\Contact.class

     文件       2502  2013-06-07 20:18  ContactsDemo\bin\classes\com\example\contactsdemo\ContactAdapter.class

     文件       2964  2013-06-07 20:18  ContactsDemo\bin\classes\com\example\contactsdemo\MainActivity$1.class

     文件       2430  2013-06-07 20:18  ContactsDemo\bin\classes\com\example\contactsdemo\MainActivity$2.class

     文件       5772  2013-06-07 20:18  ContactsDemo\bin\classes\com\example\contactsdemo\MainActivity.class

     文件        358  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$attr.class

     文件        479  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$dimen.class

     文件        550  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$drawable.class

     文件        776  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$id.class

     文件        457  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$layout.class

     文件        406  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$menu.class

     文件        490  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$string.class

     文件        449  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R$style.class

     文件        733  2013-06-12 19:55  ContactsDemo\bin\classes\com\example\contactsdemo\R.class

     文件     461388  2013-06-07 20:26  ContactsDemo\bin\classes.dex

     文件     214643  2013-06-07 20:26  ContactsDemo\bin\ContactsDemo.apk

     文件     151838  2013-05-27 14:16  ContactsDemo\bin\dexedLibs\android-support-v4-01c579673f198a3a03365244430158b2.jar

     文件        943  2013-05-27 14:16  ContactsDemo\bin\dexedLibs\annotations-7e80f6f7c9d949b206a3796ca0225e80.jar

     文件        119  2013-06-12 19:55  ContactsDemo\bin\jarlist.cache

     文件       1689  2013-06-06 14:57  ContactsDemo\bin\res\drawable-hdpi\a_z.png

     文件       1605  2013-06-06 14:57  ContactsDemo\bin\res\drawable-hdpi\a_z_click.png

     文件       5964  2013-05-27 14:16  ContactsDemo\bin\res\drawable-hdpi\ic_launcher.png

     文件        751  2013-06-06 17:48  ContactsDemo\bin\res\drawable-hdpi\section_toast.png

     文件       3112  2013-05-27 14:16  ContactsDemo\bin\res\drawable-mdpi\ic_launcher.png

     文件       9355  2013-05-27 14:16  ContactsDemo\bin\res\drawable-xhdpi\ic_launcher.png

............此处省略63个文件信息

评论

共有 条评论