这是我的活动:
et.addTextChangedListener(mTextEditorWatcher);
private final TextWatcher mTextEditorWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
}
public void onTextChanged(CharSequence s, int start, int before, int count)
{
String name =et.getText().toString();
String a ="a";
String b ="b";
String c ="c";
String d ="d";
String e ="e";
String f ="f";
String g ="g";
String h ="h";
String a1 ="\u24B6";
String b1 ="\u24B7";
String c1 ="\u24B7";
String d1 ="\u24B9";
String e1 ="\u24BB";
String f1 ="\u24BB";
String g1 ="\u24BD";
String h1 ="\u24BD";
name =name.replaceAll(a,a1);
name =name.replaceAll(b,b1);
name =name.replaceAll(c,c1);
name =name.replaceAll(d,d1);
name =name.replaceAll(e,e1);
name =name.replaceAll(f,f1);
name =name.replaceAll(g,g1);
name =name.replaceAll(h,h1);
tv.setText(name);
}
public void afterTextChanged(Editable s)
{
et.removeTextChangedListener(this);
et.addTextChangedListener(this);
}
};
在edittext
textview
中显示空格中的a或b或c是什么解决方案
显示unicode?
请帮忙
答案 0 :(得分:0)
您可以尝试:
var validateFields = function(o, required_fields) {
required_fields.forEach(function(field){
if(field in o){
if((typeof o[field] != 'undefined')){
console.log(field + ": " + o[field]);
}else{
console.log(field + " exists but is undefined");
}
}else{
console.log(field + " doesn't exist in object");
}
});
}