Android, Appcompat V21, Implement Scrolling Techniques
Solution 1:
I think this lib perfectly suits your need :
https://github.com/ksoichiro/Android-ObservableScrollView
It includes all the scrolling techniques described in the Google design specs and more.
Moreover, it brings support for ListViews
, GridViews
, ScrollViews
, RecyclerViews
and WebViews
.
Solution 2:
I think this blog post has what you're looking for. It offers a guide to make a layout similar to that (although you might have to add some code to color the app bar).
The grand idea behind this sort of "layout trick" is to implement a ScrollView
with some sort of onScrollChanged
listener. The aim is to make your Activity
aware of scroll changes and then could transform the required elements.
Once you could get a sense of the scroll position (and changes) you could use that value as a base to apply color transformation (for the ActionBar
's background) and to rescale the header text.
Hope this helps.
Solution 3:
Late but not least,
You need to you use Android Support Design Library v22 or Above. Specifically CoordinatorLayout with AppBar Layout and Toolbar.
<android.support.design.widget.CoordinatorLayoutxmlns: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.RecyclerViewandroid:layout_width="match_parent"android:layout_height="match_parent"app:layout_behavior="@string/appbar_scrolling_view_behavior" /><android.support.design.widget.AppBarLayoutandroid: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>
as mentioned in android Developer Blogpost also described in Video by Ian Lake
Post a Comment for "Android, Appcompat V21, Implement Scrolling Techniques"