Android实现Flip翻转动画效果
作者:shichen2014 时间:2022-05-11 20:08:57
本文实例讲述了Android实现Flip翻转动画效果的方法,分享给大家供大家学习借鉴。
具体实现代码如下:
LinearLayout locationLL = (LinearLayout) findViewById(R.id.locationLL);
LinearLayout baseLL = (LinearLayout) findViewById(R.id.baseLL);
private void flipit() {
Interpolator accelerator = new AccelerateInterpolator();
Interpolator decelerator = new DecelerateInterpolator();
final LinearLayout visibleList,invisibleList;
final ObjectAnimator visToInvis, invisToVis;
if (locationLL.getVisibility() == View.GONE) {
visibleList = baseLL;
invisibleList = locationLL;
visToInvis = ObjectAnimator.ofFloat(visibleList, "rotationY", 0f, 90f);
invisToVis = ObjectAnimator.ofFloat(invisibleList, "rotationY", -90f, 0f);
} else {
invisibleList = baseLL;
visibleList = locationLL;
visToInvis = ObjectAnimator.ofFloat(visibleList, "rotationY", 0f, -90f);
invisToVis = ObjectAnimator.ofFloat(invisibleList, "rotationY", 90f, 0f);
}
visToInvis.setDuration(300);
invisToVis.setDuration(300);
visToInvis.setInterpolator(accelerator);
invisToVis.setInterpolator(decelerator);
visToInvis.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
visibleList.setVisibility(View.GONE);
invisToVis.start();
invisibleList.setVisibility(View.VISIBLE);
}
});
visToInvis.start();
}
希望本文所述实例对大家Android程序设计能有一定的帮助。
标签:Android,Flip,动画
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Spring之动态注册bean的实现方法
2023-09-26 14:01:17
![](https://img.aspxhome.com/file/2023/8/79888_0s.jpg)
Java设计模式之状态模式State Pattern详解
2023-11-07 07:55:01
![](https://img.aspxhome.com/file/2023/7/80317_0s.png)
使用游长编码对字符串压缩 Run Length编码示例
2022-02-18 06:58:51
Spring Cloud微服务架构的构建:分布式配置中心(加密解密功能)
2021-10-24 05:49:59
![](https://img.aspxhome.com/file/2023/4/84604_0s.jpg)
C#反射调用dll文件中的方法操作泛型与属性字段
2022-09-15 03:24:04
Eclipse最新版使用过程中遇到的问题总结
2023-12-03 04:14:14
![](https://img.aspxhome.com/file/2023/0/82320_0s.png)
详解C#借助.NET框架中的XmlTextReader类读取XML的方法
2023-01-18 23:31:47
![](https://img.aspxhome.com/file/2023/8/75578_0s.jpg)
android实现横屏的代码及思路
2023-06-25 09:35:40
Spring Boot+Drools规则引擎整合详解
2023-11-28 20:33:00
Java异常分类及统一处理详解
2022-01-27 12:32:24
Spring框架中一个有用的小组件之Spring Retry组件详解
2021-05-27 10:07:40
使用idea创建web框架和配置struts的方法详解
2022-11-14 14:21:52
![](https://img.aspxhome.com/file/2023/2/93072_0s.png)
Java中遍历Map的六种方法实现
2022-03-21 13:30:58
java数据库唯一id生成工具类
2023-04-04 22:53:34
详解C#用new和override来实现抽象类的重写区别
2022-12-02 01:50:51
![](https://img.aspxhome.com/file/2023/1/116641_0s.png)
Android 动画之ScaleAnimation应用详解
2023-05-08 19:36:28
![](https://img.aspxhome.com/file/2023/0/122220_0s.png)
带你一文了解C#中的Expression
2023-04-20 04:37:57
![](https://img.aspxhome.com/file/2023/4/129634_0s.png)
深入探讨Java多线程中的volatile变量
2023-08-31 02:32:18
JavaWeb购物车项目开发实战指南
2022-05-30 19:32:17
![](https://img.aspxhome.com/file/2023/8/129958_0s.jpg)
IntelliJ IDEA修改新建文件自动生成注释的user名
2021-12-29 04:27:38
![](https://img.aspxhome.com/file/2023/8/69308_0s.png)