0
我使用'com.android.support:appcompat-v7:23.3.0'编译为布局,但工具栏不能位于CollapsingToolbarLayout的顶部,我不知道为什么。但使用 Compile'com.android.support:程序兼容性-V7:23.1.1”,工具栏,也可以在顶部工具栏不能位于CollapsingToolbarLayout顶部
我使用'com.android.support:appcompat-v7:23.3.0'编译为布局,但工具栏不能位于CollapsingToolbarLayout的顶部,我不知道为什么。但使用 Compile'com.android.support:程序兼容性-V7:23.1.1”,工具栏,也可以在顶部工具栏不能位于CollapsingToolbarLayout顶部
安置自己的XML代码也可能有一种错误的执行。
好了,你可以将此代码作为基础:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/MyMaterialTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/MyMaterialTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>