振动/摆动观看动画的机器人 [英] shaking / wobble view animation in android
本文介绍了振动/摆动观看动画的机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个anim.xml文件,如下面晃动的ImageView像IOS图标晃动的机器人。 然而,它并没有为我提供相同的结果。 有没有更好的主意吗?
< XML版本=1.0编码=UTF-8&GT?;
<旋转的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:时间=300
机器人:fromDegrees = - 2
机器人:pivotX =50%
机器人:pivotY =50%
安卓的repeatCount =无限
机器人:toDegrees =2/>
解决方案
尝试设置安卓REPEATMODE =反向
。下面的动画给我的Galaxy Nexus的一个非常合理的仿拟格。很明显,你可以微调的参数,以自己的喜好。
< XML版本=1.0编码=UTF-8&GT?;
<旋转的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:时间=100
机器人:fromDegrees = - 5
机器人:pivotX =50%
机器人:pivotY =50%
安卓的repeatCount =无限
机器人:REPEATMODE =反向
机器人:toDegrees =5/>
I created an anim.xml file such as below to shake imageview like IOS icon shaking in android. However it does not provide me same result. Is there any better idea?
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromDegrees="-2"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="2" />
解决方案
Try setting android:repeatMode="reverse"
. Below animation gives a very reasonable immitation on my Galaxy Nexus. Obviously you can fine tune the parameters to your own liking.
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:fromDegrees="-5"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toDegrees="5" />
这篇关于振动/摆动观看动画的机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文