Android动画混乱

时间:2014-07-04 05:57:01

标签: android

RotateAnimation rotateAnimation1 = new RotateAnimation(
        0, 360, Animation.RELATIVE_TO_SELF,
        0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation1
        .setInterpolator(new LinearInterpolator());
rotateAnimation1.setDuration(1000);
rotateAnimation1.setRepeatCount(10);

imageLoad.startAnimation(rotateAnimation1);
imageLoad.setVisibility(View.VISIBLE);
loadText.setVisibility(View.VISIBLE);

encryptButton
        .setImageResource(R.drawable.button_encrypt);

myThread thread= new myThread();
myThread.start();

thread.join();

imageLoad.setVisibility(View.INVISIBLE);
loadText.setVisibility(View.INVISIBLE);

myThread睡觉,什么都不做。然后我加入主线程。

但是,由于某种原因,线程加入后会显示动画。

有人能帮助我吗?

1 个答案:

答案 0 :(得分:3)

永远不要加入UI线程,它会阻止UI线程,直到另一个线程完成。