Shared publicly  - 
The status bar height in the Android M developer preview is changing. It is now 24dp tall in order to match Material Design quidelines (previously 25dp). From what I remember, it is also the first change in height since Android 1.0.

#AndroidDev   #Android   #gde   #blogpost  
Mateusz Wojtkiewicz's profile photoAidan Follestad's profile photoDaniele Segato's profile photoRóbert Papp (TWiStErRob)'s profile photo
Now we discover which apps use window insets correctly and which ones hardcoded the old size. 😉
+Adam Powell You got me :p The thing is (as far as I know,) there was no other way than hardode the value for preview Window as @android:dimen/statusBarSize is private and the fitSystemWindows(Rect)/dispatchApplyWindowInsets (WindowInsets) gets called way too late…
Window insets are dispatched before first layout. What are you doing that you think that's too late?
I'm sad to say that I still don't know how to use window insets correctly. 
If you describe what you need them for it may help guide an explanation.
+Adam Powell Yep but it is still too late as my code is not yet called when the system displays the startup/preview Window. What I'm doing is basically to set the Window background to a temporary Drawable that the system will used when inferring the preview Window. Once my Activity onCreate gets called, I set the background to a simpler one.

Here is my drawable :

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="">

        HACK Cyril
        25dp corresponds to @android:dimen/status_bar_height. Using this
        dimension would have been a better way to set the top inset.
        Unfortunately, the resource is not public and therefore cannot
        be used directly in this XML file.
    <item android:top="25dp">
            <item android:drawable="@drawable/action_bar"/>

            <item android:top="@dimen/action_bar_size">
                <shape android:shape="rectangle">
                    <solid android:color="@color/app_background"/>


Am I missing something ?
Ah, yeah that's not even in your process then.

A dirty starting window trick is to have a special theme that you set for the activity in your manifest, but in your onCreate immediately call setTheme to a different one that you'll actually use for the real thing. That means your manifest theme is basically just a theme for your starting window. From there, set android:statusBarColor to your desired color, any action bar style you want to show in there (even if you use a Toolbar in your layout for the real thing, etc.) and a windowBackground you're happy with.
Such a huge difference. I'm glad they've put resources into this - so amazing -_-
it may not seem like an huge difference but if you have a translucent status bar now you need to handle two different heights for your content :)
Add a comment...