第三方控件沉迷安卓动画首页投稿(暂停使用,暂停投稿)

动起来-几个Android常用动效

2016-07-15  本文已影响2090人  DreamWinter

生活不能没有运动,so让我们动起来吧^^~

下面分享几个简单、常用、不易出错的动效。

要点

Demo

Fly (点击查看)

一如既往的霍尔首页^^:


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

上一篇下一篇

猜你喜欢

热点阅读