资源连接:http://download.csdn.net/detail/txzdl/8974547
主要是修改android源码中的两个类,这是根据前辈的经验修改而来,具体文章出处已经找不到,具体项目在上面链接中
其中一个类如下:
package com.example.spelldemo;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.example.spelldemo.HanziToPinyin.Token;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.TextureView;
public class ContactLocaleUtils {
public interface FullNameStyle {
public static final int UNDEFINED = 0;
public static final int WESTERN = 1;
/**
* Used if the name is written in Hanzi/Kanji/Hanja and we could not determine
* which specific language it belongs to: Chinese, Japanese or Korean.
*/
public static final int CJK = 2;
public static final int CHINESE = 3;
public static final int JAPANESE = 4;
public static final int KOREAN = 5;
}
/**
* This class is the default implementation.
* <p>
* It should be the base class for other locales' implementation.
*/
public class ContactLocaleUtilsBase {
public String getSortKey(String displayName) {
return displayName;
}
@SuppressWarnings("unused")
public Iterator<String> getNameLookupKeys(String name) {
return null;
}
}
/**
* The classes to generate the Chinese style sort and search keys.
* <p>
* The sorting key is generated as each Chinese character' pinyin proceeding with
* space and character itself. If the character's pinyin unable to find, the character
* itself will be used.
* <p>
* The below additional name lookup keys will be generated.
* a. Chinese character's pinyin and pinyin's initial character.