android: fitsSystemWindows funktioniert nicht
In meinem Theme habe ich die folgenden Regeln definiert, um meine Ansichten hinter die Statusleiste zu zeichnen:
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
Und in der Aktivität (onCreate):
getWindow.getDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
)
Then, in meiner Ansicht verwende ich einen Barcodescanner, der hinter die Statusleiste zeichnen soll, die funktioniert. Wenn ich jedoch dasandroid:fitsSystemWindows
zu jeder untergeordneten Ansicht, deren Position nicht angepasst wird. Es funktioniert jedoch, wenn ich es auf das Stammelement anwende.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<my.Scanner
android:id="@+id/scanner"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"> <!-- Should receive a top padding, right? -->
<View android:layout_width="50dp"
android:layout_height="50dp"
android:background="@color/red" />
</FrameLayout>
</FrameLayout>