simple-view-behavior

by zoonooz

Simple and easy way to deal with CoordinatorLayout Behavior

425 Stars 71 Forks Last release: Not found MIT License 25 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Build Status

simple-view-behavior

Simple View Behavior for Android CoordinatorLayout.

This library provide you easy ways to config and setup the view behavior without creating subclass of Behavior

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 to

There 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

Author

Amornchai Kanokpullwad, @zoonref

License

simple-view-behavior is available under the MIT license. See the LICENSE file for more info.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.