安卓系统中类似Twitter的启动屏幕动画

4

2
对于 API 21+ 设备,您可以使用 Circular Reveal Transition 来获得类似的效果 - 请检查 createCircularReveal 方法。 - Joaquin Iurchuk
谢谢,但如何使用API 15实现呢?我找到了https://github.com/ozodrukh/CircularReveal,但如何将其与启动画面连接起来呢? - user3626048
1
我不确定。但是看着自述文件,似乎你可以调用 SupportAnimator animator = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius),其中你需要提供坐标和一个视图! - Joaquin Iurchuk
1个回答

7

这个链接可能对您有用,只需下载代码并按照链接提示的步骤,您可以在代码中创建:

// 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" />

要运行动画,只需调用:

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

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

}

@Override
public void onUpdate(float completionFraction){

}

@Override
public void onEnd(){

}

});`

-希望你能找到答案。


如何向应用程序添加依赖项? - Rahul Kushwaha
@RahulKushwaha,无需添加任何依赖项,只需从GitHub复制并粘贴“SplashView”类,并添加相关属性即可。 - Dinesh
1
@Dinesh 谢谢兄弟,它起作用了,我明白了。 - Rahul Kushwaha

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接