我正在尝试格式化Android中EditText的输入值,我想用货币值格式化输入,我尝试了以下内容:
EditText minimo = (EditText) view.findViewById(R.id.minimo);
Locale locale = new Locale("en", "UK");
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
Locale locale = new Locale("en", "UK");
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
minimo.setText("", TextView.BufferType.valueOf(String.valueOf(fmt.format(TextView.BufferType.EDITABLE))));
Run Code Online (Sandbox Code Playgroud)
日志:
java.lang.IllegalArgumentException: Bad class: class android.widget.TextView$BufferType
Run Code Online (Sandbox Code Playgroud)