补间动画-旋转动画: https://blog.csdn.net/qq_40881680/article/details/82261557
补间动画-透明/渐变动画: https://blog.csdn.net/qq_40881680/article/details/82261869
补间动画-组合动画(四个动画一起播放): https://blog.csdn.net/qq_40881680/article/details/82285987
属性动画
属性动画-渐变透明动画: https://blog.csdn.net/qq_40881680/article/details/82318363
属性动画-旋转动画: https://blog.csdn.net/qq_40881680/article/details/82354017
属性动画-缩放动画: https://blog.csdn.net/qq_40881680/article/details/82377850
属性动画-移动动画: https://blog.csdn.net/qq_40881680/article/details/82378391
属性动画-组合动画: https://blog.csdn.net/qq_40881680/article/details/82381258
布局文件 篇
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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”
android:orientation=“vertical”
tools:context=“.MainActivity”>
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“0dp”
android:layout_weight=“1”
android:background=“#9c98ce”
android:orientation=“vertical”
android:paddingLeft=“20dp”
android:paddingRight=“20dp”
android:paddingTop=“10dp”>
<Button
android:id=“@+id/button”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:background=“#5b7bda”
android:text=“点击演示动画”
android:textColor=“#fff” />
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“0dp”
android:layout_weight=“4”
android:orientation=“vertical”>
<ImageView
android:id=“@+id/image”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_gravity=“center”
android:layout_marginTop=“20dp”
android:background=“@mipmap/kuiba” />
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_gravity=“center”
android:text=“《魁拔》”
android:textSize=“18sp” />
代码逻辑 篇
属性动画用到的是:ObjectAnimator
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
ObjectAnimator objectAnimator;
private Button button;
private ImageView image;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
}
private void initView() {
button = (Button) findViewById(R.id.button);
image = (ImageView) findViewById(R.id.image);
button.setOnClickListener(this);
image.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button:
objectAnimator = ObjectAnimator.ofFloat(image,“translationX”,0f,60f,0f);
objectAnimator.setDuration(2000);
objectAnimator.start();
break;
case R.id.image:
Toast.makeText(this, “我是属性动画”, Toast.LENGTH_SHORT).show();
break;
}
}
}
AndroidStudio快速实例化-插件安装与使用:https://blog.csdn.net/qq_40881680/article/details/82012180
objectAnimator = ObjectAnimator.ofFloat(image,“translationX”,60f);
沿着X轴向右移动60f,效果只有一次 (负数为向左)
objectAnimator = ObjectAnimator.ofFloat(image,“translationX”,0f,60f);
动画从0f,沿着X轴向右移动60f (负数为向左)
objectAnimator = ObjectAnimator.ofFloat(image,“translationX”,0f,60f,0f);
最后
为了方便有学习需要的朋友,我把资料都整理成了视频教程(实际上比预期多花了不少精力)
当程序员容易,当一个优秀的程序员是需要不断学习的,从初级程序员到高级程序员,从初级架构师到资深架构师,或者走向管理,从技术经理到技术总监,每个阶段都需要掌握不同的能力。早早确定自己的职业方向,才能在工作和能力提升中甩开同龄人。
- 无论你现在水平怎么样一定要 持续学习 没有鸡汤,别人看起来的毫不费力,其实费了很大力,这四个字就是我的建议!!
- 我希望每一个努力生活的IT工程师,都会得到自己想要的,因为我们很辛苦,我们应得的。
当程序员容易,当一个优秀的程序员是需要不断学习的,从初级程序员到高级程序员,从初级架构师到资深架构师,或者走向管理,从技术经理到技术总监,每个阶段都需要掌握不同的能力。早早确定自己的职业方向,才能在工作和能力提升中甩开同龄人。
无论你现在水平怎么样一定要 持续学习 没有鸡汤,别人看起来的毫不费力,其实费了很大力,没有人能随随便便成功。
加油,共勉。
《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》,点击传送门,即可获取!