Android中类似Twitter的启动画面动画

时间:2015-04-27 21:13:22

标签: android twitter android-animation

如何在Android应用程序中实现类似Twitter启动画面动画(来自iOS Twitter版本)的效果? 库https://github.com/callumboddy/CBZSplashView但它仅适用于iOS。

1 个答案:

答案 0 :(得分:5)

THis link 可能对您有用,只需下载代码并根据链接建议 您可以在代码中创建:

// create and customize the view
SplashView splashView = new SplashView(context);
// the animation will last 0.5 seconds
splashView.setDuration(500);
// transparent hole will look white before the animation
splashView.setHoleFillColor(Color.WHITE);
// this is the Twitter blue color
splashView.setIconColor(Color.rgb(23, 169, 229));
// a Twitter icon with transparent hole in it
splashView.setIconResource(R.drawable.ic_twitter);
// remove the SplashView from MainView once animation is completed
splashView.setRemoveFromParentOnEnd(true);

或XML格式:

<com.yildizkabaran.twittersplash.view.SplashView 
    xmlns:app="http://schemas.android.com/apk/res/com.yildizkabaran.twittersplash"
    android:id="@+id/splash_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:icon="@drawable/ic_twitter"
    app:iconColor="@color/twitter_blue"
    app:duration="500"
    app:holeFillColor="@color/white"
    app:removeFromParentOnEnd="true" />

然后运行动画,只需调用:

- &GT;运行动画并监听动画事件(侦听器可以保留为空)

splashView.splashAndDisappear(new ISplashListener(){
    @Override
    public void onStart(){

}

@Override
public void onUpdate(float completionFraction){

}

@Override
public void onEnd(){

}

});`

- 希望你找到答案。