Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material Theming: Android Basics with Compose - Status bar collides with app. #91

Open
Elaws opened this issue Mar 1, 2024 · 1 comment

Comments

@Elaws
Copy link

Elaws commented Mar 1, 2024

URL of codelab

Codelab link

In which task and step of the codelab can this issue be found?

Task 4. "Add color". Step "Add color palette to theme".

Describe the problem

When replacing color.kt and theme.kt by the requested ones, the app collides with status bar. theme.kt given in starter code is completely different from the one given in solution code.

These kind of errors make the learning experience a bit difficult, it would be nice to review them a bit.

Versions
Android Studio version: Iguana 2023.2.1
API version of the emulator: API 34

Additional information

image

@willprada
Copy link

I didn't find another issue describing the same error. But I found out that there are 2 version of the code one with branches named starter, material and main, and others where they have the _e2e suffix, meaning edge to edge.

Reviewing both versions of the code, I found out that edge to edge version has the following line:

WindowCompat.setDecorFitsSystemWindows(window, false)

which can be found in the setUpEdgeToEdge function. And the description of the setDecorFitsSystemWindows method says:

If set to false, the framework will not fit the content view to the insets and will just pass through the WindowInsetsCompat to the content view.

link to docs

You can either remove that line or set the second argument as true. I will just set it at true.
But as I said, the branch that do not have the edge to edge config, is the one that they linked at the end of the pathway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants