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

use*_*048 3 twitter android android-animation

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

Har*_*rdy 6

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

// 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);
Run Code Online (Sandbox Code Playgroud)

或者用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" />
Run Code Online (Sandbox Code Playgroud)

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

- >运行动画并监听动画事件(侦听器可以保留为null)

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

}

@Override
public void onUpdate(float completionFraction){

}

@Override
public void onEnd(){

}
Run Code Online (Sandbox Code Playgroud)

});`

- 希望你找到答案.