在http://www.google.com/design/spec/patterns/scrolling-techniques.html中描述了滚动技术。但我没有找到如何实现的详细信息。我正在尝试实现“带图像的可伸缩空间”,有人有这方面的示例吗?
我认为这个库完全适合你的需求:
https://github.com/ksoichiro/Android-ObservableScrollView
它包括了谷歌设计规范中描述的所有滚动技术以及更多内容。此外,它还支持ListViews
、GridViews
、ScrollViews
、RecyclerViews
和 WebViews
。ScrollView
。目的是使您的Activity
意识到滚动变化,然后可以转换所需的元素。ActionBar
的背景)和重新缩放标题文本的基础。虽然有点晚,
但是你需要使用Android支持设计库 v22或更高版本。具体来说,需要使用CoordinatorLayout、AppBar Layout和Toolbar。
<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">
<! -- Your Scrollable View -->
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
...
app:layout_scrollFlags="scroll|enterAlways">
<android.support.design.widget.TabLayout
...
app:layout_scrollFlags="scroll|enterAlways">
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>