i am working in android studio and creating this layout but i do not able to create it
and the layout is overlapping the status bar.
this is the layout:
enter image description here
this is the code
<code><?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_200"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
<!-- Material Toolbar for the Top Action Bar -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_scrollFlags="scroll|enterAlways">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:background="@color/header">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Delivery"
android:textColor="@color/black"
android:textSize="20dp" />
</RelativeLayout>
</com.google.android.material.appbar.MaterialToolbar>
<!-- Include layout for throwable items -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/header">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/white"
tools:ignore="MissingConstraints">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="60dp"
tools:layout_editor_absoluteX="20dp">
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:background="@drawable/search_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:background="@null"
android:hint="Search here"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView5"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>
<!-- RecyclerView for the main content -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</code>
<code><?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_200"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
<!-- Material Toolbar for the Top Action Bar -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_scrollFlags="scroll|enterAlways">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:background="@color/header">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Delivery"
android:textColor="@color/black"
android:textSize="20dp" />
</RelativeLayout>
</com.google.android.material.appbar.MaterialToolbar>
<!-- Include layout for throwable items -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/header">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/white"
tools:ignore="MissingConstraints">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="60dp"
tools:layout_editor_absoluteX="20dp">
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:background="@drawable/search_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:background="@null"
android:hint="Search here"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView5"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>
<!-- RecyclerView for the main content -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</code>
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_200"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
<!-- Material Toolbar for the Top Action Bar -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_scrollFlags="scroll|enterAlways">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:background="@color/header">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Delivery"
android:textColor="@color/black"
android:textSize="20dp" />
</RelativeLayout>
</com.google.android.material.appbar.MaterialToolbar>
<!-- Include layout for throwable items -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/header">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/white"
tools:ignore="MissingConstraints">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="60dp"
tools:layout_editor_absoluteX="20dp">
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:background="@drawable/search_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:background="@null"
android:hint="Search here"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView5"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>
<!-- RecyclerView for the main content -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
theme:
<code> <style name="Theme.Flutter" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/white</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</code>
<code> <style name="Theme.Flutter" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/white</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</code>
<style name="Theme.Flutter" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/white</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
for full screen:
<code> private void enableEdgeToEdge(Window window) {
// Makes the content go edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false);
// Control the appearance of the system bars
WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, window.getDecorView());
// Optional: Set light status bar so the text and icons appear in dark color
controller.setAppearanceLightStatusBars(true);
// Optional: Set light navigation bar so the icons appear in dark color
controller.setAppearanceLightNavigationBars(true);
}
</code>
<code> private void enableEdgeToEdge(Window window) {
// Makes the content go edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false);
// Control the appearance of the system bars
WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, window.getDecorView());
// Optional: Set light status bar so the text and icons appear in dark color
controller.setAppearanceLightStatusBars(true);
// Optional: Set light navigation bar so the icons appear in dark color
controller.setAppearanceLightNavigationBars(true);
}
</code>
private void enableEdgeToEdge(Window window) {
// Makes the content go edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false);
// Control the appearance of the system bars
WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, window.getDecorView());
// Optional: Set light status bar so the text and icons appear in dark color
controller.setAppearanceLightStatusBars(true);
// Optional: Set light navigation bar so the icons appear in dark color
controller.setAppearanceLightNavigationBars(true);
}
i want the same transition effect and design
note: the status bar should transparent and layout should be in full screen