不要表现出性格 [英] Don't show character
本文介绍了不要表现出性格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
我写这段代码
hi
i'm write this code
public class MainActivity extends Activity {
Button btn;
EditText et;
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn =(Button)findViewById(R.id.button);
et =(EditText)findViewById(R.id.editText);
tv =(TextView)findViewById(R.id.textView);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name =et.getText().toString();
String a = "a";
String a1 = "\u00E1";
String b = "b";
String b1 = "\u00DF";
if(name.equals(a)){
tv.setText(a1);
}
else if (name.equals(b)){
tv.setText(b1);
}
}
});
}
}
当写一个编辑文本写字符时
和写b时在编辑文字写字符
,但当我写ab或ba不写字符
我尝试过:
i不知道写在这里什么
i不知道写什么
and when write a in edit text write character
and when write b in edit text write character
but when i'm write ab or ba dont write character
What I have tried:
i don't know what write here
i don't know what write here
推荐答案
最后看看你的if
子句:你的代码只放入tv
如果输入是a或b。没有考虑其他条件。
Look at yourif
clause at the end: your code only puts something intv
if the input is "a" or "b". No other conditions are considered.
我想写ab显示字符串a1和b1以及写ba写字符串b1和字符串a1
i want when write ab show string of a1 and b1 and when write ba write string b1 and string a1
这篇关于不要表现出性格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文