Nachdem ich .NoActionBar im Design deklariert habe und toolbar
in das Layout eingefügt habe, wird meine toolbar
nicht angezeigt. Was ich am Ende bekomme, ist genau das, was man erwarten würde, wenn man keine Aktionsleiste deklariert - keine Aktionsleiste. Hier ist das Layout:AppCompat-Symbolleiste wird nicht angezeigt
activity_home.xml:
<include
layout="@layout/app_bar_home"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.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/nav_header_home"
app:menu="@menu/activity_home_drawer"/>
app_bar_home.xml
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_home"/>
Sie benötigen die vollständige Struktur Ihrer XML zu schaffen, nicht nur Schnipsel. Was ist der Root-Viewgroup-Typ von activity_home? Ist es ein LinearLayout? Der wahrscheinlichste Grund für Ihre Probleme hier ist, dass sowohl das '' app_bar_home'' als auch '' nav_view'' ihr 'height' Attribut auf' match_parent' gesetzt haben, so dass eines von ihnen dem Elternteil entspricht und das andere vom Bildschirm wegschiebt. –
show java code .. –