【发布时间】:2015-08-14 09:16:47
【问题描述】:
我无法将设计支持库集成到我的应用程序中。出于某种原因,工具栏与 CollapsingToolbarLayout 一起折叠,并且不会像 Chris Banes 在 Cheesesquare 示例中那样将其固定。 https://github.com/chrisbanes/cheesesquare
我没有做任何与我的布局不同的事情。事实上,我用他的样式替换了我的样式,并放弃了他的布局。我想知道是否使用工具栏而不是 android.support.v7.widget.Toolbar 会导致这种情况。
这就是问题所在。
这是我的 AppBar 部分的 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:fitsSystemWindows="true"
app:layout_collapseMode="parallax" />
<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>
...
</android.support.design.widget.CoordinatorLayout>
【问题讨论】:
-
您对
app:layout_behavior="@string/appbar_scrolling_view_behavior"有何看法? -
你是如何制作 gif 的?
标签: android android-support-library android-toolbar androiddesignsupport android-collapsingtoolbarlayout