Sorry for bothering so much... I'm inspired today ...
# compose
a
Sorry for bothering so much... I'm inspired today 😅 I'm trying to use
accompanist
system ui controller lib, following this: https://google.github.io/accompanist/systemuicontroller/ But i found that on light theme icons are not show :S
a
If you set status bar color to transparent, you have to set
WindowCompat.setDecorFitsSystemWindows(window, false)
to extend your UI and show something behind the status bar yourself, otherwise since the bar is transparent the default surface color is displayed and dark icons won't be recognizable.
a
even not setting transparent color it not shows
Copy code
val systemUiController = rememberSystemUiController()
            val useDarkIcons = MaterialTheme.colors.isLight
            val colorPrimary = MaterialTheme.colors.primaryVariant
            SideEffect {
                systemUiController.setStatusBarColor(
                    color = colorPrimary,
                    darkIcons = useDarkIcons,
                )
            }
still shows the status bar black
because using
Copy code
android:theme="@android:style/Theme.NoTitleBar"
If I use a material theme, it shows correct
a
Then just use a material theme.
There is
@android:style/Theme.Material.NoActionBar
and
@android:style/Theme.Material.Light.NoActionBar
.
a
mmmmm
but since which API is available? 21?
a
Of course. Same as Compose UI.
a
awesome
thanks, never knew about
@android
version of material themes
building a project without
AppCompat
and
Material
libraries looks so... scary it has been so many years using them
👍 1
c
I'm going to hit this problem soon. Thanks @alorma Do you happen to know if theres an Android material daynight theme without having to pull in the entire Material lib?
a
You can easily create your own. values/themes.xml:
Copy code
<style name="Theme.MyApp" parent="android:Theme.Material.Light.NoActionBar" />
values-night/themes.xml:
Copy code
<style name="Theme.MyApp" parent="android:Theme.Material.NoActionBar" />
💯 2
a
anyway, is it needed if you use a pure compose app?
1
c
I figured you need DayNight theme in a pure compose app so your splash screen uses the right colors.
a
Yes, background color, status bar color, navigation bar color, etc from your xml theme will be used when your app is starting.
👍 2