【发布时间】:2017-04-08 09:40:17
【问题描述】:
我有这个非常简单的布局:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ActionBarThemeOverlay">
<!--<include layout="@layout/include_toolbar_actionbar" />-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
我将带有标准RecyclerView 的Fragment 添加到fragment_container 中。不幸的是,Toolbar 总是隐藏,我不明白为什么?
非常感谢你们的帮助!
【问题讨论】:
标签: android android-studio android-appbarlayout android-collapsingtoolbarlayout