I am trying to show make an activity in my app where the statusbar is completely transparent. I added this to my style:
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
But for some reason all views in my are all appearing below the statusbar. All the views are top aligned to parent app:layout_constraintTop_toTopOf="parent".

I fixed it by adding the following code to my activity:
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Since I wanted to show my layout behind the status bar but still keep the navigation bar the same, this is what worked for me:
Add <item name="android:statusBarColor">@android:color/transparent</item> to my activity theme
Since ConstraintLayout does not seem to respect fitsSystemWindows, wrap it in a CoordinatorLayout.
Add android:fitsSystemWindows="true" to my CoordinatorLayout.
Add to my ConstraintLayout
android:fitsSystemWindows="true"
android:clipToPadding="false"
android:clipChildren="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With