My Android app starts with the following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click"/>
</RelativeLayout>
Activity have an offset for status bar.
I want to remove this offset at runtime by clicking on the button. By clicking on the button I do the following, but it doesn't work, nothing happens:
findViewById(R.id.root).setFitsSystemWindows(false);
How can I do that?