I implemented the splash pack on my android app.
implementation 'androidx.core:core-splashscreen:1.0.0'
However, color of the bar under camera turned to white after splash screen in landscape orientation. Before splash screen it was black. How to modify it?
XML codes of splash screen theme
<resources>
<style name="Theme.Zebraman.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/darkThemeTopBar</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_splash_dark_round</item>
<item name="postSplashScreenTheme">@style/Theme.Zebraman</item>
</style>
</resources>
CodePudding user response:
res/values/styles.xml:
<!-- Define the splash screen theme -->
<style name="Theme.MyApp.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splash_screen_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_splash_animated_icon</item>
<item name="postSplashScreenTheme">@style/Theme.MyApp</item>
</style>
<!-- Define the app theme -->
<style name="Theme.MyApp" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/my_app_primary_color</item>
<item name="colorPrimaryDark">@color/my_app_primary_dark_color</item>
</style>
AndroidManifest.xml:
<activity android:name="com.mycompany.myapp.SplashScreenActivity"
android:theme="@style/Theme.MyApp.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Declare the main activity -->
<activity android:name="com.mycompany.myapp.MainActivity"
android:theme="@style/Theme.MyApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
SplashScreenActivity.kt:
class SplashScreenActivity : SplashScreen() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Add any customizations to the splash screen here
}
}
CodePudding user response:
I hope this will help
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>