【发布时间】:2012-02-03 08:33:12
【问题描述】:
目前我的来源是这样的
System.out.println(text1+" "+text2); // displays the correct values.
this.view1.setText(""+text1); // should display the same values
this.view1.setText(""+text2); //
((Activity)getContext()).runOnUiThread(new Runnable()
{
public void run()
{ invalidate(); }
});
这是另一个对象每 30 秒调用一次的方法的一部分。 TextViews 放置在 LinearLayout 上。
开始时显示的文本是“0”。 现在我希望它每 30 秒更改一次以显示给定的文本(例如“5”和“10”)。
视图似乎没有重绘。
我希望已经说清楚了。谢谢!
【问题讨论】:
-
查看您正在使用最后一个 setText() 方法用 text2 重写 text1 的示例
-
你在 UI Thread 中设置 Text 吗?
-
无法理解你的问题..你的意思是像一个计时器..那么你可以使用计时器来实现这个