2024年Android最全Android旋转动画,2024年最新软件开发项目经理面试题库及答案

最后

给大家送上我成功跳槽复习中所整理的资料,由于文章篇幅有限,所以只是把题目列出来了

image

image

image

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!


2个参数的构造方法



/**

 * Constructor to use when building a RotateAnimation from code.

 * Default pivotX/pivotY point is (0,0).

 * 

 * @param fromDegrees Rotation offset to apply at the start of the animation.

 * @param toDegrees Rotation offset to apply at the end of the animation.

 */

public RotateAnimation(float fromDegrees, float toDegrees) {

    mFromDegrees = fromDegrees;

    mToDegrees = toDegrees;

    mPivotX = 0.0f;

    mPivotY = 0.0f;

}

  • 第一个参数是图片旋转的起始度数

  • 第二个参数是图片旋转结束的度数

用法


RotateAnimation ta = new RotateAnimation(0, 360);

// 设置动画播放的时间

ta.setDuration(1000);

// 开始播放动画

iv.startAnimation(ta);

效果

以图片左上角为旋转中心,顺时针旋转360度

P


4个参数的构造方法



    /**

     * Constructor to use when building a RotateAnimation from code

     * 

     * @param fromDegrees Rotation offset to apply at the start of the animation.

     * @param toDegrees Rotation offset to apply at the end of the animation.

     * @param pivotX The X coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the left edge.

     * @param pivotY The Y coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the top edge.

     */

    public RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY) {

        mFromDegrees = fromDegrees;

        mToDegrees = toDegrees;



        mPivotXType = ABSOLUTE;

        mPivotYType = ABSOLUTE;

        mPivotXValue = pivotX;

        mPivotYValue = pivotY;

        initializePivotPoint();

    }

  • 头两个参数和上面两个参数的构造方法一样,是开始和结束的角度

  • 后两个参数是设置图片的旋转中心

用法


RotateAnimation ta = new RotateAnimation(0, 360, iv.getWidth() / 2, iv.getHeight() / 2);

// 设置动画播放的时间

ta.setDuration(1000);

// 开始播放动画

iv.startAnimation(ta);

效果

以图片中心为旋转中心,顺时针旋转360度


6个参数的构造方法



/**

* Constructor to use when building a RotateAnimation from code

* 

* @param fromDegrees Rotation offset to apply at the start of the animation.

* @param toDegrees Rotation offset to apply at the end of the animation.

* @param pivotXType Specifies how pivotXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.

* @param pivotXValue The X coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the left edge. This value can either be an absolute number if pivotXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.

* @param pivotYType Specifies how pivotYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.

* @param pivotYValue The Y coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the top edge. This value can either be an absolute number if pivotYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.

*/

public RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) {

   mFromDegrees = fromDegrees;

   mToDegrees = toDegrees;



   mPivotXValue = pivotXValue;

   mPivotXType = pivotXType;

   mPivotYValue = pivotYValue;

   mPivotYType = pivotYType;

   initializePivotPoint();

}

  • 比4个参数的构造方法多了第三个和第五个参数,其他用法一样,第三个和四五个参数分别设置第四个和第六个参数的类型,四个参数的构造没有设置,是默认设置了Animation.ABSOLUTE类型

用法


// 创建旋转的动画对象

RotateAnimation ta = new RotateAnimation(0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);

// 设置动画播放的时间

ta.setDuration(1000);

// 开始播放动画

iv.startAnimation(ta);

效果

和上面一样,以图片中心为旋转中心,顺时针旋转360度。


设置动画重复播放的次数的方法



/**

 * Sets how many times the animation should be repeated. If the repeat

 * count is 0, the animation is never repeated. If the repeat count is



**《960全网最全Android开发笔记》**

![](https://img-blog.csdnimg.cn/img_convert/157fba29fad0af61eac50fa6f06f4282.webp?x-oss-process=image/format,png)

**《379页Android开发面试宝典》**

![](https://img-blog.csdnimg.cn/img_convert/c5c3f0239a5f7c8e9c745e36eb0644d5.webp?x-oss-process=image/format,png)

**《507页Android开发相关源码解析》**

![](https://img-blog.csdnimg.cn/img_convert/91590e2fd37b6fa5ba5ba0837d1a4095.webp?x-oss-process=image/format,png)

>因为文件太多,全部展示会影响篇幅,暂时就先列举这些部分截图
>



**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化学习资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618156601)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

片转存中...(img-hHA3ZKC9-1714829852724)]

>因为文件太多,全部展示会影响篇幅,暂时就先列举这些部分截图
>



**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化学习资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618156601)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值