我正在尝试为我的应用程序构建启动画面。当我尝试更改我的 imagesview 属性并设置动画时,我收到一个错误。
我已经测试了 runonuithread 和 Hadler,但是在这 2 种情况下,没有错误,屏幕上也没有显示任何内容,并且在延迟(正是我在代码中指定的内容)之后,程序活动切换到下一个活动,这是我的代码:
@Override
public void run(){
try {
TranslateAnimation moveLefttoRight = new TranslateAnimation(500, 0, 0, 0);
moveLefttoRight.setDuration(5000);
moveLefttoRight.setFillAfter(true);
im.startAnimation(moveLefttoRight);//im is an image view
SystemClock.sleep(6000);
TranslateAnimation moveRighttoLeft = new TranslateAnimation(0, 100, 0, 0);
moveRighttoLeft.setDuration(1000);
moveRighttoLeft.setFillAfter(true);
im.startAnimation(moveRighttoLeft);
SystemClock.sleep(6000);
ScaleAnimation scale = new ScaleAnimation(0.3f, 1f, 0.3f, 1f,
ScaleAnimation.RELATIVE_TO_SELF, 0f,
ScaleAnimation.RELATIVE_TO_SELF, 0f);
scale.setDuration(1000);
scale.setFillAfter(true);
// Wait given period of time or exit on touch
sig.startAnimation(scale);//sig is an image view
SystemClock.sleep(2000);
}
我该如何解决这个奇怪的错误?