2024年最全浅谈Android动画之属性动画ValueAnimator和ObjectAnimator(1),2024年最新嵌入式工程师面试都问什么

最后

今天关于面试的分享就到这里,还是那句话,有些东西你不仅要懂,而且要能够很好地表达出来,能够让面试官认可你的理解,例如Handler机制,这个是面试必问之题。有些晦涩的点,或许它只活在面试当中,实际工作当中你压根不会用到它,但是你要知道它是什么东西。

最后在这里小编分享一份自己收录整理上述技术体系图相关的几十套腾讯、头条、阿里、美团等公司2021年的面试题,把技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,这里以图片的形式给大家展示一部分。

还有 高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料 帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习。

【算法合集】

【延伸Android必备知识点】

【Android部分高级架构视频学习资源】

**Android精讲视频领取学习后更加是如虎添翼!**进军BATJ大厂等(备战)!现在都说互联网寒冬,其实无非就是你上错了车,且穿的少(技能),要是你上对车,自身技术能力够强,公司换掉的代价大,怎么可能会被裁掉,都是淘汰末端的业务Curd而已!现如今市场上初级程序员泛滥,这套教程针对Android开发工程师1-6年的人员、正处于瓶颈期,想要年后突破自己涨薪的,进阶Android中高级、架构师对你更是如鱼得水,赶快领取吧!

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

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

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

<Button

android:id=“@+id/buttonSpin”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

android:text=“单一动画”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toBottomOf=“@+id/buttonValue” />

2.设置动画在MainActicity.java中修改

// 创建动画作用对象:此处以Button为例

private Button buttonSpin;

// 动画作用的对象的属性是透明度alpha

// 动画效果是:常规 - 全透明 - 常规

objectAnimator1 = ObjectAnimator.ofFloat(imageView,“alpha”,1F,0F,1F);

buttonSpin.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

AnimatorSet animatorSet = new AnimatorSet();

//执行objectAnimator1

animatorSet.playSequentially(objectAnimator1);

// 设置动画运行的时长

animatorSet.setDuration(5000);

// 启动动画

animatorSet.start();

效果图


在这里插入图片描述

平移


实例说明:


1.设置布局文件在activity_main.xml修改

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:app=“http://schemas.android.com/apk/res-auto”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

tools:context=“.MainActivity”>

<Button

android:id=“@+id/buttonSpin”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

android:text=“单一动画”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toBottomOf=“@+id/buttonValue” />

2.设置动画在MainActicity.java中修改

// 创建动画作用对象:此处以Button为例

private Button buttonSpin;

// 动画作用的对象的属性是X轴平移

objectAnimator2 = ObjectAnimator.ofFloat(imageView,“translationX”,0F,300F);

buttonSpin.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

AnimatorSet animatorSet = new AnimatorSet();

//执行objectAnimator2

animatorSet.playSequentially(objectAnimator2);

// 设置动画运行的时长

animatorSet.setDuration(5000);

// 启动动画

animatorSet.start();

效果图


在这里插入图片描述

缩放


实例说明:


1.设置布局文件在activity_main.xml修改

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:app=“http://schemas.android.com/apk/res-auto”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

tools:context=“.MainActivity”>

<Button

android:id=“@+id/buttonSpin”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

android:text=“单一动画”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toBottomOf=“@+id/buttonValue” />

2.设置动画在MainActicity.java中修改

// 创建动画作用对象:此处以Button为例

private Button buttonSpin;

// 动画作用的对象的属性是X轴缩放

objectAnimator5 = ObjectAnimator.ofFloat(imageView,“scaleX”,0F,4F,2F);

buttonSpin.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

AnimatorSet animatorSet = new AnimatorSet();

//执行objectAnimator5

animatorSet.playSequentially(objectAnimator5);

// 设置动画运行的时长

animatorSet.setDuration(5000);

// 启动动画

animatorSet.start();

效果图


在这里插入图片描述

在上面的讲解,我们使用了属性动画最基本的四种动画效果:透明度、平移、旋转 & 缩放

即在ObjectAnimator.ofFloat()的第二个参数String property传入alpha、rotation、translationX 和 scaleY 等blabla

| 属性 | 作用 |

| — | — |

| Alpha | 控制View的透明度 |

| TranslationX | 控制X方向的位移 |

| ScaleX | 控制X方向的缩放倍数 |

| TranslationY | 控制Y方向的位移 |

| ScaleY | 控制Y方向的缩放倍数 |

| Rotation | 控制以屏幕方向为轴的旋转度数 |

| RotationX | 控制以X轴为轴的旋转度数 |

| RotationY | 控制以Y轴为轴的旋转度数 |

2、叠加动画


各个属性动画同时进行

实例说明:


1.设置布局文件在activity_main.xml修改

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:app=“http://schemas.android.com/apk/res-auto”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

tools:context=“.MainActivity”>

<Button

android:id=“@+id/buttonTogether”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

android:text=“叠加动画”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toBottomOf=“@+id/imageView” />

<ImageView

android:id=“@+id/imageView”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toTopOf=“parent”

app:srcCompat=“@mipmap/ic_launcher” />

2.设置动画在MainActicity.java中修改

/ imageView = findViewById(R.id.imageView);

buttonTogether = findViewById(R.id.buttonTogether);

buttonSequentially = findViewById(R.id.buttonSequentially);

buttonValue = findViewById(R.id.buttonValue);

buttonSpin = findViewById(R.id.buttonSpin);

// 动画作用的对象的属性是透明度alpha

// 动画效果是:常规 - 全透明 - 常规

objectAnimator1 = ObjectAnimator.ofFloat(imageView,“alpha”,1F,0F,1F);

// 动画作用的对象的属性是X轴平移

objectAnimator2 = ObjectAnimator.ofFloat(imageView,“translationX”,0F,300F);

// 动画作用的对象的属性是y轴平移

objectAnimator3 = ObjectAnimator.ofFloat(imageView,“translationY”,0F,200F);

// 动画作用的对象的属性是旋转

objectAnimator4 = ObjectAnimator.ofFloat(imageView,“rotation”,0F,360F);

// 动画作用的对象的属性是X轴缩放

objectAnimator5 = ObjectAnimator.ofFloat(imageView,“scaleX”,0F,4F,2F);

// 动画作用的对象的属性是y轴缩放

objectAnimator6 = ObjectAnimator.ofFloat(imageView, “scaleY”, 2F,4F);

buttonTogether.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

AnimatorSet animatorSet = new AnimatorSet();

//同时经行objectAnimator2,objectAnimator3,objectAnimator4动画

animatorSet.playTogether(objectAnimator2,objectAnimator3,objectAnimator4);

// 启动动画

animatorSet.start();

}

});

效果图


在这里插入图片描述

3、顺序动画


各个属性动画同时进行

实例说明:


1.设置布局文件在activity_main.xml修改

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:app=“http://schemas.android.com/apk/res-auto”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

tools:context=“.MainActivity”>

<Button

android:id=“@+id/buttonSequentially”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

android:text=“顺序动画”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toBottomOf=“@+id/buttonTogether” />

<ImageView

android:id=“@+id/imageView”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginStart=“8dp”

android:layout_marginLeft=“8dp”

android:layout_marginTop=“8dp”

android:layout_marginEnd=“8dp”

android:layout_marginRight=“8dp”

app:layout_constraintEnd_toEndOf=“parent”

app:layout_constraintStart_toStartOf=“parent”

app:layout_constraintTop_toTopOf=“parent”

app:srcCompat=“@mipmap/ic_launcher” />

2.设置动画在MainActicity.java中修改

imageView = findViewById(R.id.imageView);

buttonTogether = findViewById(R.id.buttonTogether);

buttonSequentially = findViewById(R.id.buttonSequentially);

buttonValue = findViewById(R.id.buttonValue);

buttonSpin = findViewById(R.id.buttonSpin);

最后

其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。

上面分享的腾讯、头条、阿里、美团、字节跳动等公司2019-2021年的高频面试题,博主还把这些技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,上面只是以图片的形式给大家展示一部分。

【Android思维脑图(技能树)】

知识不体系?这里还有整理出来的Android进阶学习的思维脑图,给大家参考一个方向。

【Android高级架构视频学习资源】

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

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

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

Id(R.id.buttonValue);

buttonSpin = findViewById(R.id.buttonSpin);

最后

其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。

上面分享的腾讯、头条、阿里、美团、字节跳动等公司2019-2021年的高频面试题,博主还把这些技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,上面只是以图片的形式给大家展示一部分。

【Android思维脑图(技能树)】

知识不体系?这里还有整理出来的Android进阶学习的思维脑图,给大家参考一个方向。

[外链图片转存中…(img-a58zsDTd-1715899658359)]

【Android高级架构视频学习资源】

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值