Android Studio fading splash into main

前端 未结 1 1393
我在风中等你
我在风中等你 2021-02-06 07:59

I currently am working on an android app. Just started and I was able to implement my splash screen. However, I don\'t like the transition between that and the main activity. I

1条回答
  •  再見小時候
    2021-02-06 08:31

    You could use two .xml files to fade in a new Activity and fade out the current Activity.

    fade_in.xml

    
    
    

    fade_out.xml

    
    
    

    Use it in code like that: (Inside your Activity)

    Intent intent = new Intent();
            intent.setClass(sPlashScreen, MainActivity.class);
            startActivity(intent);
    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    

    The above code will fade out the currently active Activity and fade in the newly started Activity.

    0 讨论(0)
提交回复
热议问题