我为波斯语字符串编写了一个自定义TextView,这个TextView应该将英文数字替换成波斯数字
public class PersianTextView extends TextView {
public PersianTextView(Context context) {
super(context);
}
public PersianTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public PersianTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setText(CharSequence text, BufferType type) {
String t = text.toString();
t = t.replaceAll("0", "?");
t = t.replaceAll("1", "?");
t = t.replaceAll("2", "?");
t = t.replaceAll("3", "?");
t = t.replaceAll("4", "?");
t = t.replaceAll("5", "?");
t = t.replaceAll("6", "?");
t = t.replaceAll("7", "?");
t = …
Run Code Online (Sandbox Code Playgroud)