Android, appcompat v21, implement scroll methods

Http://www.google.com/design/spec/patterns/scrolling-techniques.html describes scrolling methods. But I did not find details on how to implement it. I am trying to implement "Flexible Image Space", who has an example of this?

+5
source share
3 answers

I think this lib is ideal for your need:

https://github.com/ksoichiro/Android-ObservableScrollView

It includes all the scrolling methods described in Google's design specifications and more. Moreover, it supports ListViews , GridViews , ScrollViews , RecyclerViews and WebViews .

+7
source

I think this blog post has what you are looking for. It offers guidance for creating a layout like this (although you may have to add code to color the application bar).

The great idea of ​​such a β€œlayout” is to implement a ScrollView with some kind of onScrollChanged listener. The goal is to make your Activity available to change the scroll, and then transform the necessary elements.

Once you know about the scroll position (and changes), you can use this value as a base for applying color conversion (for the ActionBar background) and for scaling the title text.

Hope this helps.

+2
source

Later, but no less

You need to use Android Design Library v22 or higher. In particular, CoordinatorLayout with AppBar layout and 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> 

as stated in android Developer Blogpost also described in Jan Lake Video

+1
source

Source: https://habr.com/ru/post/1207313/


All Articles