【发布时间】:2016-06-13 04:53:58
【问题描述】:
下面是代码sn-p,有人可以帮我吗?我的折叠工具栏根本没有折叠。预期的行为是:当我向上滚动时,工具栏应该从168dp 折叠到56dp。但它根本没有崩溃。
提前致谢。
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/one_primaryColor"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="168dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
app:layout_collapseMode="pin">
<ImageView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:contentDescription="@string/app_name"
app:layout_collapseMode="parallax"
android:src="@drawable/logo" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView...
【问题讨论】:
-
AppBarLayout 下面是什么?
-
@AntonTarasov 请立即检查代码。
-
@AntonTarasov 这两者有什么区别?我错过了什么?它是否需要我没有设置的特定主题/样式/属性?
标签: android material-design android-toolbar android-collapsingtoolbarlayout