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>