view 状态动画
stateListAnimator
一、xml配置 方法
res/xml/animate_scale.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- the pressed state; increase x and y size to 150% -->
<item android:state_pressed="true">
<set>
<objectAnimator android:propertyName="scaleX"
android:duration="@android:integer/config_shortAnimTime"
android:valueTo="1.5"
android:valueType="floatType"/>
<objectAnimator android:propertyName="scaleY"
android:duration="@android:integer/config_shortAnimTime"
android:valueTo="1.5"
android:valueType="floatType"/>
</set>
</item>
<!-- the default, non-pressed state; set x and y size to 100% -->
<item android:state_pressed="false">
<set>
<objectAnimator android:propertyName="scaleX"
android:duration="@android:integer/config_shortAnimTime"
android:valueTo="1"
android:valueType="floatType"/>
<objectAnimator android:propertyName="scaleY"
android:duration="@android:integer/config_shortAnimTime"
android:valueTo="1"
android:valueType="floatType"/>
</set>
</item>
</selector>
调用方:
<Button android:stateListAnimator="@xml/animate_scale"
... />
二、java代码中调用
AnimatorInflater.loadStateListAnimator()
View.setStateListAnimator()
AnimatedStateListDrawable
<!-- res/drawable/myanimstatedrawable.xml -->
<animated-selector
xmlns:android="http://schemas.android.com/apk/res/android"> <!-- provide a different drawable for each state-->
<item android:id="@+id/pressed" android:drawable="@drawable/drawableP"
android:state_pressed="true"/>
<item android:id="@+id/focused" android:drawable="@drawable/drawableF"
android:state_focused="true"/>
<item android:id="@id/default"
android:drawable="@drawable/drawableD"/> <!-- specify a transition -->
<transition android:fromId="@+id/default" android:toId="@+id/pressed">
<animation-list>
<item android:duration="15" android:drawable="@drawable/dt1"/>
<item android:duration="15" android:drawable="@drawable/dt2"/>
...
</animation-list>
</transition>
...
</animated-selector>
view 状态动画的更多相关文章
- Android添加系统级顶层窗口 和 WindowManager添加view的动画问题
当Dialog有编辑框时如果选择会弹菜单窗口就不要用 Context applicationContext = mainActivity.getApplicationContext(); AlertD ...
- 如何递归执行view的动画
如何递归执行view的动画 效果: 山寨的源头: 图片素材: 源码: // // ViewController.m // RepeatAnimationView // // Created by Yo ...
- Android view状态保存
为什么我们需要保存View的状态? 这个问题问的好!我坚信移动应用应该帮助你解决问题,而不是制造问题. 想象一下一个非常复杂的设置页面: 这并不是从一个移动应用的截图(这不是典型的win32程序吗.. ...
- 看完这篇再不会 View 的动画框架,我跪搓衣板
引言 众所周知,一款没有动画的 app,就像没有灵魂的肉体,给用户的体验性很差.现在的 android 在动画效果方面早已空前的发展,1.View 动画框架 2.属性动画框架 3.Drawable 动 ...
- VUE3 之 状态动画 - 这个系列的教程通俗易懂,适合新手
1. 概述 老话说的好:不用羡慕别人,每个人都有属于自己的人生道路,重要的是在前进道路上遇见阻碍时,如何去积极的面对并解决. 言归正传,今天我们来聊聊 VUE 的状态动画. 2. 状态动画 2.1 数 ...
- Android设置View抖动动画
在应用中,有时候我们要吸引用户去点击某些按钮,比如应用市场的推荐按钮,为了能够吸引用户主动点击而且不过分的打扰用户,最好的方法就是给我们想吸引用户注意的view添加一些抖动动画,比如这张图 这里我主要 ...
- iOS的view翻转动画实现--代码老,供参考
新建一个view-based模板工程,在ViewController文件中添加下面的代码,即可实现翻转效果: - (void)viewDidLoad { [super viewDidLoad]; // ...
- 3 View - 状态保持 session
1.状态保持 http协议是无状态的:每次请求都是一次新的请求,不会记得之前通信的状态 客户端与服务器端的一次通信,就是一次会话 实现状态保持的方式:在客户端或服务器端存储与会话有关的数据 存储方式包 ...
- 自定义View淡出动画
//AllGestureView为自定义view AllGestureView *gestureView=[[AllGestureView alloc]init]; gestureView.frame ...
随机推荐
- 10.15 lzxkj
几天前写的,忘了放了,在此填坑 10月16的题我出的不写题解了 lzxkj 题目背景 众所不周知的是, 酒店之王 xkj 一个经常迷失自我的人 有一天, 当起床铃再一次打响的时候, TA 用 O(1) ...
- window.performance
利用window.performance查看网页性能 一般我们可以通过浏览器的调试工具-网络面板,或者代理工具查看网页加载过程中的各个阶段的耗时.而利用window.performance属性则可以获 ...
- 17.Merge Two Binary Trees(合并两个二叉树)
Level: Easy 题目描述: Given two binary trees and imagine that when you put one of them to cover the ot ...
- [Java]如何把Soap Message装成一个String对象
代码片段 // Create transformer TransformerFactory tff = TransformerFactory.newInstance(); Transformer tf ...
- vue学习—组件的定义注册
组件的定义注册 效果: 方法一: <div id="box"> <v-header></v-header> <hr /> <b ...
- echarts和highcharts
highcharts是基于svg技术的 echarts基于canvas 后者可以在浏览器中实现3D图形 链接 ,这种效果highcharts是完全不可能做得到的.
- python自动化day1
一.变量 变量定义的规则: 变量名只能是 字母.数字或下划线的任意组合 变量名的第一个字符不能是数字 以下关键字不能声明为变量名['and', 'as', 'assert', 'break', 'cl ...
- 解决IDEA卡顿问题及相关基本配置
https://blog.csdn.net/u013068377/article/details/54316965 https://blog.csdn.net/u014527619/article/d ...
- hive支持事务及单行操作 update delete
测试环境 Hive 1.2.1000.2.6.0.3-8 set hive.support.concurrency=true; set hive.exec.dynamic.partition.mod ...
- 转 Celery 使用
http://www.mamicode.com/info-detail-1798782.html https://blog.csdn.net/lu1005287365/article/details/ ...