0

hi,how to define different or add new layout in include in app bar XML with Coordinator Layout with XML in android studio?

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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"
    android:fitsSystemWindows="true"
    tools:context=".....MainActivity">
        <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:fitsSystemWindows="true"
        >  <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            android:fitsSystemWindows="true"
            />    
    </android.support.design.widget.AppBarLayout>
        <include layout="@layout/content_main"

        />


</android.support.design.widget.CoordinatorLayout>

2 Answers2

0

1º I dont know if this is what you want, but you can use tabbed activity and use some fragments, so this way you always have the same app bar.

2º You can add the toolbar to a fragment, u can check this answer if you dont know how to do it How to add Action bar options menu in Android Fragments

Community
  • 1
  • 1