improve broken status bar layouting

This commit is contained in:
Vincent Breitmoser
2022-12-22 14:51:33 +01:00
parent a17a6e9131
commit 6f987f2920
22 changed files with 50 additions and 105 deletions

View File

@@ -1,27 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<include
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<!--
fitsSystemWindows and layout_marginTop from
https://medium.com/@ngdelamo/using-drawerlayout-the-material-way-i-716bba2b5705
-->
<FrameLayout
android:layout_below="@id/toolbar_include"
android:fitsSystemWindows="true"
android:layout_marginTop="@dimen/minus_statusbar_height"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="UnusedAttribute" />
<FrameLayout
android:id="@+id/create_key_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/create_key_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</RelativeLayout>
</LinearLayout>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/custom_actionbar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text=""
android:textSize="18sp" />
</LinearLayout>

View File

@@ -7,14 +7,8 @@
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone_white" />
<!--
fitsSystemWindows and layout_marginTop from
https://medium.com/@ngdelamo/using-drawerlayout-the-material-way-i-716bba2b5705
-->
<LinearLayout
android:layout_below="@id/toolbar_include"
android:fitsSystemWindows="true"
android:layout_marginTop="@dimen/minus_statusbar_height"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@@ -13,8 +13,6 @@
-->
<LinearLayout
android:layout_below="@id/toolbar_include"
android:fitsSystemWindows="true"
android:layout_marginTop="@dimen/minus_statusbar_height"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@@ -14,8 +14,6 @@
<LinearLayout
android:layout_below="@id/toolbar_include"
android:id="@+id/content_frame"
android:fitsSystemWindows="true"
android:layout_marginTop="@dimen/minus_statusbar_height"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@@ -14,8 +14,6 @@
<LinearLayout
android:layout_below="@id/toolbar_include"
android:id="@+id/content_frame"
android:fitsSystemWindows="true"
android:layout_marginTop="@dimen/minus_statusbar_height"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

View File

@@ -7,16 +7,10 @@
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<!--
fitsSystemWindows and layout_marginTop from
https://medium.com/@ngdelamo/using-drawerlayout-the-material-way-i-716bba2b5705
-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar_include"
android:layout_marginTop="@dimen/minus_statusbar_height"
android:fitsSystemWindows="true"
android:orientation="vertical">
<include layout="@layout/notify_area" />

View File

@@ -2,16 +2,16 @@
<LinearLayout 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="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
@@ -19,8 +19,7 @@
<FrameLayout
android:id="@+id/main_fragment_container"
android:layout_gravity="center"
android:layout_height="match_parent"
android:layout_width="match_parent" />
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@@ -3,23 +3,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!--
We always have windowTranslucentStatus=true to get under the status bar.
Thus this ImageView is the part under the status bar!
-->
<ImageView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/statusbar_height"
android:background="@color/transparent" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_below="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/transparent"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="UnusedAttribute" />

View File

@@ -3,23 +3,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!--
We always have windowTranslucentStatus=true to get under the status bar.
Thus this ImageView is the part under the status bar!
-->
<ImageView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/statusbar_height"
android:background="@color/transparent" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_below="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/transparent"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="UnusedAttribute" />

View File

@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar_include"
android:elevation="4dp"
android:background="?attr/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
>
<include
android:id="@+id/toolbar_inner_layout"
layout="@layout/toolbar_inner_layout" />
</RelativeLayout>
</FrameLayout>

View File

@@ -4,7 +4,8 @@
android:elevation="4dp"
android:background="@color/android_orange_light"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
>
<include
android:id="@+id/toolbar_inner_layout"

View File

@@ -4,7 +4,8 @@
android:elevation="4dp"
android:background="?attr/colorBrightToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
>
<include
android:id="@+id/toolbar_inner_layout"

View File

@@ -5,7 +5,8 @@
android:elevation="4dp"
android:background="?attr/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
>
<include
android:id="@+id/toolbar_inner_layout"

View File

@@ -20,7 +20,6 @@
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/primary"
app:expandedTitleMarginBottom="102dp"
app:expandedTitleMarginEnd="128dp"
@@ -31,7 +30,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="238dp"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
<TextView