github とhereのこのサンプルchrisbanes/cheesesquareに基づいて、新しい Android デザイン ライブラリを使用しています。
サンプルを実行しましたが、CheeseDetailActivity 内のツールバーに問題があります。ツールバーが正しく表示されません。以下の画像をご覧ください。
最初の画像では、ツールバーが正しく表示されていないことがわかります。
2 番目の画像では、ツールバーは正しく表示されていますが、通知バーは白くなっています。これは、activvty_detail.xmlandroid:fitsSystemWindows="true"
から削除したために発生します。android.support.design.widget.CoordinatorLayout
fitsSystemWindows
それは真実であり、問題は関連していると思いますがandroid.support.design.widget.AppBarLayout
、この問題を解決する方法がわかりません。marginTop
と同じ高さで試してみましnotificationBar
たが、うまくいきませんでした。
どんな提案でも大歓迎です:)
これは次の一部ですactivity_detail.xml
。
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>