Why does the toolbar go to the context menu? How to fix?

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:elevation="4dp" android:layout_width="match_parent" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:layout_height="wrap_content" android:background="@color/status_bar_orange"/> 

This is how it is displayed enter image description here

This is how it should be displayed, on some devices the toolbar is displayed correctly. enter image description here

Here is the beginning of a single lavaut where a toolbar is imported.

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:weightSum="1" android:background="@color/layout_background"> <include layout="@layout/toolbar" /> 
  • The rest of the markup where and how should be displayed? Most likely, you need to mark elements in the container, for example, the vertical LinearLayout - pavlofff
  • @pavlofff added a usage example at the end - Pavel Dura
  • context menu you call the statusbar and you do not like that toolbar comes for statusbar? This happens when a transparent statusbar is used in the subject. - pavlofff

0