3

当我运行我的应用程序时,我可以通过运行来选择要在 viewFlipper 中显示的视图:

viewFlipper.setDisplayedChild(1);

在 onCreate 中,我可以在 onClick() 中切换视图

viewFlipper.setDisplayedChild(0);

当我想从我的代码(不在我的主应用程序中)切换孩子时,我遇到了以下问题!

02-02 12:17:08.620: ERROR/AndroidRuntime(1005): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

任何帮助表示赞赏。

4

1 回答 1

5

setDisplayedChild()仅从主应用程序线程调用,而不是从后台线程调用。

于 2011-02-02T12:54:59.090 回答