get rid of extra space on top app bar

This commit is contained in:
izzy2lost
2026-01-15 10:21:39 -05:00
parent 8e1d61f837
commit 78c94f0ba9
2 changed files with 180 additions and 3 deletions
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-20dp"
android:fitsSystemWindows="false"
android:background="?attr/colorPrimary"
android:paddingTop="0dp"
android:paddingBottom="0dp"
app:materialThemeOverlay="@style/ThemeOverlay.Material3Expressive.AppBarWithSearch"
app:elevation="8dp"
app:liftOnScroll="false">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:minHeight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:paddingStart="0dp"
android:paddingEnd="0dp"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp">
<ImageView
android:id="@+id/app_logo"
android:layout_width="180dp"
android:layout_height="180dp"
android:layout_gravity="top|center_horizontal"
android:layout_marginTop="-16dp"
android:contentDescription="@string/app_name"
android:src="@drawable/logo" />
<ImageButton
android:id="@+id/btn_theme_toggle"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="top|end"
android:layout_marginTop="44dp"
android:layout_marginEnd="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/theme_toggle"
android:src="@drawable/dark_mode_24px"
android:tint="?attr/colorOnPrimary" />
</FrameLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-64dp">
<ImageButton
android:id="@+id/btn_open_drawer"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/open_menu"
android:src="@drawable/ic_menu_24"
android:tint="?attr/colorOnPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.search.SearchBar
android:id="@+id/search_bar"
android:layout_width="0dp"
android:layout_height="38dp"
android:minHeight="38dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:hint="Search games"
app:liftOnScroll="true"
app:liftOnScrollColor="?attr/colorSurfaceContainerHighest"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.72" />
<ImageButton
android:id="@+id/btn_view_mode"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Change view"
android:src="@drawable/view_list_24px"
android:tint="?attr/colorOnPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/games_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:background="?android:attr/colorBackground"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.search.SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Search games"
android:elevation="16dp"
app:autoShowKeyboard="true"
app:layout_anchor="@id/search_bar">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/search_results_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:background="?android:attr/colorBackground"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</com.google.android.material.search.SearchView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="@drawable/drawer_background_rounded"
app:menu="@menu/drawer_menu"
app:headerLayout="@layout/nav_header"
app:itemTextColor="?attr/colorOnPrimary"
app:itemIconTint="?attr/colorOnPrimary" />
</androidx.drawerlayout.widget.DrawerLayout>
@@ -13,6 +13,7 @@
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-20dp"
android:fitsSystemWindows="false"
android:background="?attr/colorPrimary"
android:paddingTop="0dp"
@@ -50,8 +51,8 @@
<ImageView
android:id="@+id/app_logo"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_width="180dp"
android:layout_height="180dp"
android:layout_gravity="center"
android:contentDescription="@string/app_name"
android:src="@drawable/logo" />
@@ -61,6 +62,7 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="4dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/theme_toggle"
android:src="@drawable/dark_mode_24px"
@@ -70,7 +72,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-50dp">
android:layout_marginTop="-64dp">
<ImageButton
android:id="@+id/btn_open_drawer"