0

I would like my Android app to manage waterfall displays automatically if present, in that I do not wish for the texts, buttons, etc to be displayed all the way to the screen's border if the screen is waterfall, as I find this not to be user friendly.

I've tried to explicitely state the WindowCompat true, but that doesn't seem to help

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        context = this
        sharedPref = getSharedPreferences("app_settings", Context.MODE_PRIVATE)
        WindowCompat.setDecorFitsSystemWindows(window, true)
        super.onCreate(savedInstanceState)
        setContent {

I've also tried to to put the WindowCompat to false and manually add an instet padding to WindowInsets.waterfall without any success

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        context = this
        sharedPref = getSharedPreferences("app_settings", Context.MODE_PRIVATE)
        WindowCompat.setDecorFitsSystemWindows(window, false)
        super.onCreate(savedInstanceState)
        setContent {
            myTheme(chosenTheme = themeSelection.value) {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier
                      .windowInsetsPadding(WindowInsets.waterfall),

Any clue as to what I am doing wrong ? Is there a way to fix this at the same level as WindowCompat, so that it's valid for the full app?

Thanks!

Arnianor
  • 43
  • 1
  • 6

0 Answers0