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>
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>
Related
I'm trying to fix a bug in our React Native application where in dark mode, the native android Alert dialog is displaying a very dark gray background with black text on the buttons, making it unreadable:
unreadable android Alert dialog in dark mode
The solution looks like applying a custom style to the Alert is the right way to go. I have my main styles in android/app/src/main/res/values/styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">#color/splashscreen_bg</item>
<item name="android:background">#drawable/background_splash</item>
</style>
</resources>
which produces the following result in light mode (unmodified):
normal Android alert dialog
To fix the dark mode issue, I've added another file in android/app/src/main/res/values-night/styles.xml with the following contents:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="android:alertDialogTheme">#style/AlertTheme</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">#color/splashscreen_bg</item>
<item name="android:background">#drawable/background_splash</item>
</style>
<style name="AlertTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:textColor">#FFFFFF</item>
<item name="android:background">#000000</item>
<item name="android:colorAccent">#000000</item>
</style>
</resources>
Which seems to fix the color issue, producing the following result in dark mode:
custom dark mode Android alert dialog
But now it looks like the padding or gravity on the buttons is messed up, like the space is below the buttons instead of above (like in the light mode screenshot).
Any ideas? Is there a better way to do this that I'm not aware of?
I'm trying to make the background of an android 12 splash screen use #android:color/system_neutral1_900 as the background, but as I can see, the color loads only after the splash screen. Is there any way to use it on the splash screen?
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
<!-- Set the splash screen background, animated icon, and animation duration. -->
<item name="windowSplashScreenBackground">#android:color/system_neutral1_900</item>
</style>
The color does not appear and it uses the default grey. I also tried with other system_ colors and the same result comes up. Using #android:color/black or hex colors works.
Try using this item as part of your main application theme according to this link
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowSplashScreenBackground">#color/colorAccent</item>
</style>
I'm trying to change status bar color on the Splash Screen in Flutter for Android. But, whatever I do, it's color remaining unchanged (black). I've tried settings colorPrimaryDark, statusBarColor and other things in Android styles.xml. Is it possible at all?
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">#drawable/background</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
I applied a gradient background to my ActionBar. I can see it in the preview on Eclipse but when I run the app on my phone, the action bar vanishes completely. Why is this happening?
styles.xml
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">#style/AppTheme.ActionBarStyle</item>
</style>
<style name="AppTheme.ActionBarStyle" parent="android:Theme.Holo.Light">
<item name="android:background">#drawable/bg_actionbar</item>
</style>
</resources>
try use to:
Drawable d=getResources().getDrawable(R.drawable.background_image_name);
getActionBar().setBackgroundDrawable(d);
and see this question link
I want to get rid of the white color during the short period when my app is launching but the content isn't displayed, yet.
My main activity is using a style (from the Manifest) that extends #style/Theme.Sherlock.Light.DarkActionBar with the background set to <item name="android:background">#android:color/transparent</item>. Nowhere in my layout do I use a white background color, yet it appears for a brief moment during app launch.
In the HierarchyViewer I exported the layers and checked back that there is really no white solid in the layout hierarchy.
What setting controls the background color before the layout is drawn? Thanks.
There's another background attribute in your theme - windowBackground, and you implicitly set it to white by inheriting your style from #style/Theme.Sherlock.Light.DarkActionBar (notice the .Light. part in the name).
You can either use dark version of theme or set it explicitly by including windowBackground in your style definition:
<item name="android:windowBackground">#color/your_color</item>
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
Or you can use drawable. I created a theme for my spash screen like as below :)
<style name="SceneTheme.Light.NoActionBar" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="SceneTheme.Light.NoActionBar.Transparent.StatusBar" parent="SceneTheme.Light.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowBackground">#drawable/bg_splash</item>
</style>