gpt4 book ai didi

android - Android 中类似 Twitter 的闪屏动画

转载 作者:行者123 更新时间:2023-12-02 15:58:22 24 4
gpt4 key购买 nike

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

最佳答案

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

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

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

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

}

@Override
public void onUpdate(float completionFraction){

}

@Override
public void onEnd(){

}

});`

-希望您能找到答案。

关于android - Android 中类似 Twitter 的闪屏动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29906028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com