嗨,我试图在由线程运行的方法中使用 .setText 设置 textview 的值,但它被附加到 TextView 中。参数 String f 是在 for 循环中发送到方法的,如下所示:
for (int j = 0; j < 5; j++) {
String[] string = array[j].split(":");
String y= string[0];
String x= string[1];
determineSeat(y, something, x);
}
}
private void determineSeat(String is, String cs, String f)
{
TextView txtHand = null;
String txt = null;
if (iSeat < cSeat) {
x = cSeat - iSeat;
if (x == 1) {
txtHand = (TextView) findViewById(R.id.txtHand8);
txt = txtHand.getText().toString();
txtHand.setText("");
txtHand.setText(txt + ":" + f);
}
}
XML:
<TextView
android:id="@+id/txtHand1"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:text=" " />
我希望每次我在文本视图中放一些东西而不是被附加时都将其清除,有人知道问题是什么吗?