Android Question [solved] Starting app with dark mode

angel_

Well-Known Member
Licensed User
Longtime User
When I start the app the white screen appears while loading the views, how can I remove this effect or directly start the app with the dark mode?, is possible?

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)

SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, MyAppTheme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    </style>
</resources>
)
 

Attachments

  • TestDark.zip
    11.5 KB · Views: 229

angel_

Well-Known Member
Licensed User
Longtime User
Make sure that your app appears as fast as possible. In most cases it should load fast enough that you don't need to worry about the base activity color.

If you are loading a large layout file then you can defer it by adding Sleep(50) before loading the layout.
I tried that but it appears like a flash, it is very very short but it is uncomfortable
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top