-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[AppBarLayout] statusBarForeground not working/glitch #824
Comments
@chrisbanes Can you clarify whether |
Hmmm no that doesn't look working as intended. I'd expect that the status bar foreground should be draw above the Toolbar. This was working fine for us in the I/O 2019 app so I'm not entirely sure what it has stopped working now. |
Interesting. If I sync back to the original commit, 5b94ec8, I still see the same behavior in the demo: |
This might be an an elevation issue? Hard to say without looking at the view hierarchy (and I'm deep in dark mode bugs at the minute unfortunately). |
@chrisbanes Do you have any tips on how to dynamically color the status bar in my app, depending on the screen (fragments using navigation components, so an activity theme is not an option). This looked as one of the ways of doing it, but also like a very "new" method. Some screens are white, some are dark, etc. The statusbar should reflect this. Is there anything i can do to help? I really, really(!), want to implement statusbar colors in the app i'm working on. It really fits the design. |
Hi @Guuz, can you try using Window#setStatusBarColor? https://stackoverflow.com/a/26749343 You should be able to do that from within each fragment. |
Note: using This is actually pretty easy to achieve using a simple view in your fragment layout. You just need make sure it's height is updated to match the Here's an example from iosched: layout, activity, HeightTopWindowInsetsListener |
@chrisbanes thanks for the example! Very helpful! I'd hoped there would be an "out of the box" solution. Seeing as you see this design pattern in so many apps, even in Google's apps. (The toolbar and statusbar being a single color and joining together.) |
@dsn5ft cool! you fixed it! how can i keep track of in what release this will be? and could you give a timeframe on that? So we can decide to wait for that or implement a solution as @chrisbanes showed here #824 (comment) |
Hi @Guuz, we're planning on including this fix in the next release, which should be coming out within a week. In the meantime, if you'd like to help us verify that this issue is fully resolved, we did just start publishing nightly snapshot releases. So the fix should be included here: To start using it you need to create a GitHub access token, and add the following to your
Then you can use the |
@dsn5ft i'll test this with our app and get back to you asap! (probably within 24 hours) |
@dsn5ft IT WORKS! 🎉 🙌 |
Great! Thanks for verifying so quickly! |
Description: When using the statusBarForeground feature of the AppBarLayout, and scrolling down, you can stil see the Toolbar content behind the statusbar. This looks really weird and does not look like how it is intended at all. You can see this in the Catalog example app. I have included a video.
In my own app the "scrim" sometimes appears but does not scroll with the user and is just very glitchy in general.
Video: https://streamable.com/1zsyv
Expected behavior: When scrolling the statusbar should be the set color, not transparent.
Source code: 5b94ec8
Android API version: Tested on 27 and 29
Material Library version: 1.1.0-beta02 and 1.2.0-alpha02
Device: Pixel emulators
The text was updated successfully, but these errors were encountered: