生活不能没有运动,so让我们动起来吧^^~
下面分享几个简单、常用、不易出错的动效。
一如既往的霍尔首页^^:
fly.gif
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:padding="@dimen/text_margin"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="滚动的 TextView ^ ^
abcdefghijklmnopqrstuvwxyz 1234567890
one two three four five six seven eight nine ten "/>
boolean hasShowingAnimation;
/*View 自身动画*/
private void showSelfAnimation() {
if (hasShowingAnimation)
mSelfAnimationTv.animate()
.rotation(0)
.alpha(1f)
.translationY(0)
.scaleX(1f)
.scaleY(1f);
else
mSelfAnimationTv.animate()
.rotation(90)
.alpha(0.5f)
.translationY(300)
.scaleX(1.3f)
.scaleY(1.3f);
hasShowingAnimation = !hasShowingAnimation;
}
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#dfa">
<item>
<selector>
<item
android:drawable="@android:color/transparent"
android:state_pressed="true">
</item>
<item android:drawable="@android:color/white"/>
</selector>
</item>
</ripple>
本文Demo: https://github.com/XunMengWinter/Fly
Material Design初露锋芒: http://www.jianshu.com/p/e64a4e08f57a