1

I currently have a Toolbar and a FrameLayout in the activity. The problem is that during runtime, the FrameLayout expands and covers the toolbar, which I do not want. How should I modify the toolbar so that it stays on top of all views under it?

The layout file :

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:mapbox="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar"
        mapbox:layout_constraintBottom_toTopOf="@id/frameLayout"
        mapbox:layout_constraintLeft_toLeftOf="parent"
        mapbox:layout_constraintRight_toRightOf="parent"
        mapbox:layout_constraintTop_toTopOf="parent" />

    <FrameLayout
        android:id="@+id/frameLayout"
        android:layout_width="match_parent"
        android:layout_height="600dp"
        mapbox:layout_constraintBottom_toBottomOf="parent"
        mapbox:layout_constraintEnd_toEndOf="parent"
        mapbox:layout_constraintStart_toStartOf="parent"
        mapbox:layout_constraintTop_toBottomOf="@id/toolbar"
        android:paddingTop="2dp">

        // Map here.

    </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Community
  • 1
  • 1
kshitij86
  • 129
  • 1
  • 8

0 Answers0