Ok, podam inny przykład, bez listy. Na zrzucie będzie activity pełnoekranowe, więc i tak paska statusu nie widać, ale to nie jest ważne bo problem pozostaje. Jest to przerobiony (na ConstraingLayout) layout z ResideMenu, które wkleiłem wyżej. A więc po kolei:
MainActivity:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/white"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/layout_top"
tools:layout_constraintTop_creator="1"
tools:layout_constraintRight_creator="1"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#2ea3fe"/>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="28dp"
android:layout_height="28dp"
android:background="@drawable/titlebar_menu_selector"
android:id="@+id/title_bar_left_menu"
android:layout_gravity="left|center_vertical"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="7dp"
android:text="Test"
android:textSize="24sp"
android:textColor="#999999"
android:layout_gravity="center"/>
<Button
android:layout_width="28dp"
android:layout_height="28dp"
android:background="@drawable/titlebar_menu_selector"
android:id="@+id/title_bar_right_menu"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="10dp"/>
</FrameLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="#ebebeb"/>
</LinearLayout>
<FrameLayout
android:layout_width="0dp"
android:orientation="vertical"
android:id="@+id/main_fragment"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/layout_top">
</FrameLayout>
</android.support.constraint.ConstraintLayout>
Jak widać, fragment jest wrzucany w main_fragment, a akurat ten fragment ze zrzutu ekranu wygląda tak:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:id="@+id/homeMainLayout">
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerInside"
android:id="@+id/imageView"
android:src="@drawable/gesture"
tools:layout_constraintTop_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/textView"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.41"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text=" 1. Przesuń w lewo/prawo aby pokazać menu"
android:id="@+id/textView"
android:clickable="false"
android:textColor="#ffacacac"
android:textSize="17sp"
android:padding="5dp"
tools:layout_conversion_absoluteX="17dp"
tools:layout_conversion_absoluteY="254dp"
tools:layout_conversion_absoluteWidth="348dp"
tools:layout_conversion_absoluteHeight="30dp"
app:layout_constraintBottom_toTopOf="@+id/btn_open_menu"
android:layout_marginBottom="24dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintVertical_bias="1.0"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:textAlignment="center"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_selector"
android:textColor="@android:color/white"
android:text="2. Kliknij aby pokazać menu"
android:textSize="17sp"
android:padding="12dp"
android:id="@+id/btn_open_menu"
tools:layout_conversion_absoluteX="56dp"
tools:layout_conversion_absoluteY="289dp"
tools:layout_conversion_absoluteWidth="272dp"
tools:layout_conversion_absoluteHeight="48dp"
app:layout_constraintRight_toRightOf="@+id/imageView"
app:layout_constraintLeft_toLeftOf="@+id/imageView"
app:layout_constraintBottom_toTopOf="@+id/ignored_view"
android:layout_marginBottom="8dp"
app:layout_constraintHorizontal_bias="1.0"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"/>
<FrameLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="120dp"
android:padding="10dp"
android:id="@+id/ignored_view"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/frame"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="17sp"
android:textColor="#9a9a9a"
android:id="@+id/textView1"
android:gravity="center"
android:layout_gravity="center"
android:padding="5dp"/>
</FrameLayout>
</android.support.constraint.ConstraintLayout>
I teraz najciekawsze. Gdy mam ustawione w stylu tak:
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
Powyższy fragment wyświetla się dobrze:
Ale jeśli w stylu jest tak:
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
to bez żadnych zmian w layoucie (jedyna zmiana to powyższe w stylu), fragment wyświetli sie tak:
I co państwo na to? Tylko podkreślę jeszcze raz:
- w tym przypadku paska stanu nie widać, bo akurat activity jest na pełny ekran (taki akurat mam przykład pod ręką). W innych apkach muszę mieć pasek stanu, więc nie jest tak dobrze jak tu
- nie piszcie co WY byście inaczej zrobili w layoucie, takiego objawu nie powinno być.
- tak samo zachowuje się każda lista (ListView, RecyclerView/CardView itd).
- na urządzeniach bez navbar jest zawsze dobrze