我应该添加什么才能在每次点击时在文本视图之间切换?它只适用于一键。这可能很容易解决,所以提前致谢!
public void status(View view) {
TextView textView2 = findViewById(R.id.textView2);
if (textView2.getText() == "uhuh") {
textView2.setText("u uh");
} else {
textView2.setText("u huh");
}
}
答案 0 :(得分:0)
public void status(View view) {
TextView textView2 = findViewById(R.id.textView2);
String check = textView2.getText().toString();
if (check.equals("u huh")) {
textView2.setText("u uh");
}
else{
textView2.setText("u huh");
}
}