安卓场景动画

相信在现在APP中为了追求更好的体验或多或少都会使用场景动画提高用户体验,本片文章算是对安卓文档Animating Views Using Scenes and Transitions的知识小结,比较基础的应用,所谓的场景动画就是在预先设置的两个界面,分别展示着不同的状态,在对容器切换状态时使用安卓提供的场景动画,就会达到一种动画般的平滑过度的效果。

1. ChangeBounds

先看一下简单的效果:
这里写图片描述

从效果看出两个图片交换位置并进行缩放的状态,看一下代码,你会发现其实这样的效果只需要几部就可实现。
首先像上面说的一样创建两个场景即两个不同状态的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">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="80dp"
        android:layout_height="80dp"
        app:srcCompat="@drawable/abc"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="8dp"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent" />

    <ImageView
        android:id=
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值