这可是我按照emoji表情表格,一个一个找来的,希望能帮到你,累死我了。
private Pattern emoji = Pattern.compile(
"[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]|" +
"[\uD83E\uDD10-\uD83E\uDD2f]|" +
"[\uD83E\uDD10-\uD83E\uDD6f]|" +
"[\uD83E\uDDD0-\uD83E\uDDD5]|" +
"[\uD83E\uDDC0]|" +
"[\uD83E\uDDE0-\uD83E\uDDE6]|" +
"[\uD83E\uDD80-\uD83E\uDD97]",
Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
Matcher emojiMatcher = emoji.matcher(source);
if (emojiMatcher.find()) {
return "";
} else {
return null;
}
}