ImageView loading = (ImageView) findViewById(R.id.iv_pre_loading);
private void showRotate() {
Animation mRotateAnimation = new RotateAnimation(0.0f, 720.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateAnimation.setFillAfter(true);
mRotateAnimation.setInterpolator(new LinearInterpolator());
mRotateAnimation.setDuration(1200);
mRotateAnimation.setRepeatCount(Animation.INFINITE);
mRotateAnimation.setRepeatMode(Animation.RESTART);
loading.setVisibility(View.VISIBLE);
//设置为半透明
loading.setAlpha(0.5f);
loading.setAnimation(mRotateAnimation);
}
private void stopRotate() {
loading.setAnimation(null);
loading.setVisibility(View.GONE);
}
网友评论