Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zoonooz/simple-view-behavior
Simple and easy way to deal with CoordinatorLayout Behavior
https://github.com/zoonooz/simple-view-behavior
android android-ui animation appbarlayout coordinatorlayout
Last synced: 29 days ago
JSON representation
Simple and easy way to deal with CoordinatorLayout Behavior
- Host: GitHub
- URL: https://github.com/zoonooz/simple-view-behavior
- Owner: zoonooz
- License: mit
- Created: 2016-01-02T09:11:37.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-02T21:06:54.000Z (over 6 years ago)
- Last Synced: 2024-10-31T03:05:19.485Z (about 1 month ago)
- Topics: android, android-ui, animation, appbarlayout, coordinatorlayout
- Language: Java
- Size: 9.67 MB
- Stars: 444
- Watchers: 23
- Forks: 72
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - simple-view-behavior - 简单视图行为 (AppBar)
README
[![Build Status](https://travis-ci.org/zoonooz/simple-view-behavior.svg?branch=master)](https://travis-ci.org/zoonooz/simple-view-behavior)
# simple-view-behavior
Simple View Behavior for Android [CoordinatorLayout](http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html).
This library provide you easy ways to config and setup the view behavior without creating subclass of
[Behavior](http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior.html)## Installation
```
compile 'com.zoonref:simple-view-behavior:1.0'
```## Usage
You can setup behavior effect by using only xml option.1. set the layout behavior to this library class `app:layout_behavior="com.zoonref.SimpleViewBehavior"`
2. set the dependency view by specify resource id by `app:dependsOn="@+id/{your view id}"`
3. set the type of dependency `app:dependType="{x,y,width,height}"`
4. set the dependency view target value according to the type you choose `app:dependTargetXXX="{value}"`
5. set the target appearance that you want your view to animate toThere are **two** ways to specify the animation when the dependency view changed.
### 1. xml
```
```
This View will depend on the `y` positon of `@+id/app_bar` which is AppBarLayout. View will animation from current state of AppBarLayout until
y position of AppBarLayout is `-156dp` with the animation, View will animate alpha to `app:targetAlpha="1"` rotate x to `app:targetRotateX="0"`**Don't forget to add** `xmlns:app="http://schemas.android.com/apk/res-auto"`
**The output will be**
### 2. view animation resource file
When you use animation, all of animate target option from xml will be ignored.
for example
```
```
```
```
**The output will be**
### Options
You can see all available option at [attrs.xml](https://github.com/zoonooz/simple-view-behavior/blob/master/library/src/main/res/values/attrs.xml)
## Author
Amornchai Kanokpullwad, [@zoonref](https://twitter.com/zoonref)
## License
simple-view-behavior is available under the MIT license. See the LICENSE file for more info.