美文网首页
旋转动画实现

旋转动画实现

作者: 跟我去北方吧 | 来源:发表于2018-04-28 11:35 被阅读0次
    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);
        }
    

    相关文章

      网友评论

          本文标题:旋转动画实现

          本文链接:https://www.haomeiwen.com/subject/fafglftx.html