Search code examples
androidandroid-studioandroid-toolbar

Need helping Fixing ToolBar issue in Android Studio


The toolbar is in Purple above the Tablayout in my XML file.

enter image description here

However, here as you can see for some reason the toolbar which is supposed to be the MainActivity and the Settings in those 3 dots, now for some reason the toolbar is in between the MainActivity toolbar and the tab layout.

enter image description here

How to fix this? I want the purple toolbar to disappear from the middle. What can I do?


Solution

  • To remove this toolbar the simplest way to do it is set it visibility as gone. This property will make the toolbar invisible and it doesn't take any space on the layout:

    <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:visibility="gone"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.PopupOverlay">
    
        </android.support.v7.widget.Toolbar>