Android – fitssystemwindows ignored by constraintlayout

I try to display an activity in my application. The status bar is completely transparent. I add 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 my views appear below the status bar. All views are aligned with the top of the parent application: layout_ constraintTop_ toTopOf =“parent”.

resolvent:

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);

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>