5
在主题中声明.NoActionBar之后,以及将toolbar
置于布局中,我的toolbar
未显示。我最终得到的正是你在声明没有操作栏时所期望的 - 没有操作栏。这里是布局:AppCompat工具栏未显示
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"/>
您需要提供您的XML,不只是片段的完整结构。 “activity_home”的根视图组类型是什么?它是一个'LinearLayout'吗?这里的麻烦最可能的原因是'app_bar_home'和'nav_view'都将其'height'属性设置为'match_parent',所以它们中的一个匹配父级,并将另一个推到屏幕外。 –
显示java代码.. –