Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/satorufujiwara/material-scrolling
Android library for material scrolling techniques.
https://github.com/satorufujiwara/material-scrolling
Last synced: 3 months ago
JSON representation
Android library for material scrolling techniques.
- Host: GitHub
- URL: https://github.com/satorufujiwara/material-scrolling
- Owner: satorufujiwara
- License: apache-2.0
- Created: 2015-09-16T12:15:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-03T02:35:32.000Z (over 8 years ago)
- Last Synced: 2024-06-16T05:38:20.393Z (5 months ago)
- Language: Java
- Homepage:
- Size: 2.71 MB
- Stars: 597
- Watchers: 15
- Forks: 106
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - material-scrolling - MD风格的滚动效果安卓库 (滚动效果(Scroll))
README
material-scrolling
===
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-material--scrolling-green.svg?style=flat)](https://android-arsenal.com/details/1/2529)
[![Download](https://api.bintray.com/packages/satorufujiwara/maven/material-scrolling/images/download.svg)](https://bintray.com/satorufujiwara/maven/material-scrolling/_latestVersion)Android library for [material scrolling techniques](http://www.google.com/design/spec/patterns/scrolling-techniques.html).
![ViewPager](/arts/viewpager.gif) ![ImageFab](/arts/imagefab.gif)
![ViewPagerLand](/arts/viewpager_land.gif)# Features
* Easily implement [material scrolling techniques](http://www.google.com/design/spec/patterns/scrolling-techniques.html) with RecyclerView.
* Customize the behavior while scrolling.
* Support RecyclerView in ViewPager.# Usage
(For a working implementation of this project see the [sample](./sample).)
## MaterialScrollingLayout
Layout `ObservableRecyclerView` inside of `MaterialScrollingLayout`.
```xml
```
`ms_flexible_height`is height from `RecyclerView`s top to `RecyclerView`'s first item.And call `MaterialScrollingLayout.addBehavior(View, Behavior)` in Activity or Fragment.
First argument is target `View`.
Second argument is `View`'s behavior while scrolling.```java
materialScrollingLayout.addBehavior(bgImageView, new ParallaxBehavior());
materialScrollingLayout.addBehavior(titleTextView, new ScrollingBehavior());
materialScrollingLayout.addBehavior(fabView, new FabBehavior(getResources()));
````FabBehavior` is customized `Behavior`.
If you want customize behavior, create class that extends 'Behavior'.```java
public class TitleBehavior extends Behavior {
private final int scrollLimitHeight;public TitleBehavior(Resources r) {
scrollLimitHeight = r.getDimensionPixelOffset(R.dimen.title_scroll_height);
}@Override
protected void onScrolled(View target, int scrollY, int dy) {
ViewCompat.setTranslationY(target, -Math.min(scrollY, scrollLimitHeight));
}
}
```## MaterialViewPager
If you want to use with `ViewPager`, use `MaterialViewPager`.
And PagerAdapter must imptelement `MaterialScrollingViewPager.ContainRecyclerViewPagerAdapter`.
```xml
```
And call `MaterialScrollingViewPager.addBehavior(View, Behavior)` in Activity or Fragment.
# Gradle
```groovy
repositories {
jcenter()
}
dependencies {
compile 'jp.satorufujiwara:material-scrolling:1.2.1'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
}
```# Developed By
Satoru Fujiwara (satorufujiwara)
* Twitter [satorufujiwara](https://twitter.com/satorufujiwara)
* [email protected]
Other Projects
* [recyclerview-binder](https://github.com/satorufujiwara/recyclerview-binder)
* Android Library for RecyclerView to manage order of items and multiple view types.
* [lighthttp](https://github.com/satorufujiwara/lighthttp)
* Lightweitht HTTP client for Android# Dependencies
* Library
* [Android-ObservableScrollView](https://github.com/ksoichiro/Android-ObservableScrollView)* Sample
* [recyclerview-binder](https://github.com/satorufujiwara/recyclerview-binder)
* [SmartTabLayout](https://github.com/ogaclejapan/SmartTabLayout)License
-------
Copyright 2015 Satoru FujiwaraLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.