Please find the Activity xml
<?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"
android:fitsSystemWindows="true"
android:background="@color/white"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_10ssp"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu"
android:layout_width="@dimen/_15sdp"
android:layout_height="@dimen/_15sdp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginStart="@dimen/_10sdp"
android:background="@drawable/ic_menu"
android:visibility="visible"
/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/mediumTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/text"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/_14ssp" />
<com.suke.widget.SwitchButton
android:id="@+id/sb_private"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
app:sb_background="@color/light3"
app:sb_checked="false"
app:sb_checked_color="@color/colorPrimary"
app:sb_checkline_color="@color/colorPrimary"
app:sb_show_indicator="false"
app:sb_uncheck_color="@color/light3"
app:sb_uncheckcircle_color="@color/white"
/>
</RelativeLayout>
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<FrameLayout
android:id="@+id/fl_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</RelativeLayout>
</LinearLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/layout_nav_header"
app:menu="@menu/activity_main_drawer"
android:background="@color/white"
android:visibility="visible"
/>
and this is my child fragment xml file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragment.MapFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="@dimen/_30sdp"
android:layout_height="@dimen/_30sdp"
android:id="@+id/iv_my_location"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/_20sdp"
android:layout_marginEnd="@dimen/_20sdp"
app:srcCompat="@drawable/ic_my_location_light4_with_background"
android:visibility="gone"
/>
</RelativeLayout>
</FrameLayout>
I am displaying map in child fragments and I need to show the Toolbar in the map at top position,(Toolbar background should be transparent to map)
But , child fragment is hiding the toolbar, how to bring this Toolbar inside the map ? Toolbar is common to all fragments.
My requirement is , "Map should occupy whole page it should not below to the tool bar , that's y I didn't give the layout below in Framelayout
Add/Replace the fragment inside the Framelayout with id fl_main_container
Also add
android:layout_below="@id/toolbar"
to the framelayout i mentioned, that will basically make the entire portion below the toolbar free to be occupied with the fragment, currently it is occuptying the whole screen thus covering the toolbar
EDIT:
Since the map should occupy the whole screen, skip the layout below part.... instead use the wonderful android way of painting views and simply put the toolbar below the framelayout in the xml.... It should paint the toolbar above the framelayout