私はついにそれを解決したと思います。
public class CustomTextView extends AppCompatTextView {
private static final String FITZPATRICK_PREFIX = "\uD83C";
public CustomTextView(Context context) {
this(context, null);
}
public CustomTextView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public CustomTextView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setText(final CharSequence text, final BufferType type) {
super.setText(stripFitzpatrickCharacters(text == null ? "" : text.toString()), type);
}
public static String stripFitzpatrickCharacters(@NonNull final String string) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N && string.contains(FITZPATRICK_PREFIX)) {
final String[] parts = string.split(FITZPATRICK_PREFIX);
final StringBuilder builder = new StringBuilder();
builder.append(parts[0]);
for (int i = 1; i < parts.length; i++) {
builder.append(parts[i].substring(1));
}
return builder.toString();
} else {
return string;
}
}
}