美文网首页
android ——不停旋转动画

android ——不停旋转动画

作者: 未聞椛洺 | 来源:发表于2017-06-14 17:32 被阅读0次

    xml文件

    ```

    <set 

    <rotate

    android:fromDegrees="359"

    android:toDegrees="0"

    android:duration="1000"

    android:repeatCount="-1"

    android:pivotX="50%"

    android:pivotY="50%"/>

    </set>

    代码

    /开始旋转/

    public voidstartRotateAnimation(View view, intsetid) {

    Animation rotateAnim = AnimationUtils.loadAnimation(this,setid);

    LinearInterpolator lin =newLinearInterpolator();

    rotateAnim.setInterpolator(lin);

    if(rotateAnim !=null) {

    view.startAnimation(rotateAnim);

    }

    }

    /*

    停止旋转

    */

    public voidstopRotateAnimation(View v) {

    v.clearAnimation();

    }

    ```

    相关文章

      网友评论

          本文标题:android ——不停旋转动画

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