GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Lauzy/LBehavior: [NO LONGER SUPPORTED]Simple implementation of sliding animation of title bar, bottom bar and floatingActionButton.

BranchesTags
Open more actions menu

Latest commit

 

History

34 Commits
34 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
apk
apk
 
 
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
lbehaviorlib
lbehaviorlib
 
 
screenshots
screenshots
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
README_CN.md
README_CN.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

LBehavior: Simple implementation of sliding animation of title bar, bottom bar and floatingActionButton.

中文文档

Screenshots

screenshot screenshot screenshot

Blog Introduce

JianShu: http://www.jianshu.com/p/2974d8ffc3a5

Download

    allprojects {
	    repositories {
		    ...
		    maven { url 'https://jitpack.io' }
	    }
	}

    dependencies {
        implementation 'com.github.Lauzy:LBehavior:VERSION_CODE'
	}

The version code of the latest release can be found here

Usage

Xml file:

The root layout must be CoordinatorLayout,which is similar to FrameLayout

    <android.support.design.widget.CoordinatorLayout
        ...>
		<FloatingActionButton
 			...
			app:layout_behavior="@string/fab_vertical_behavior/>
    </android.support.design.widget.CoordinatorLayout>

Set different layout_behavior in xml file according to different view.

Param Explanation
@string/title_view_behavior TitleBar
@string/bottom_view_behavior BottomBar
@string/fab_scale_behavior FloatingActionButton(scale anim)
@string/fab_vertical_behavior FloatingActionButton(slide anim)

Custom properties(All have default values):

Function Param Explanation
setMinScrollY int y Sets the minimum sliding distance for triggering the animation. The default value is 5 pixels.
setScrollYDistance int y Sets the sliding distance for triggering the animation. The animation can be triggered when the total sliding distance is greater than this property, even if the single sliding distance is less than the minimum distance. The default value is 40 pixels.
setDuration int duration Sets the length of the animation. The default value is 400 milliseconds.
setInterpolator Interpolator interpolator Sets the interpolator to be used by this animation.The default interpolator is LinearOutSlowInInterpolator. Interpolator official documentation
    CommonBehavior behavior = CommonBehavior.from(mFloatingActionButton);

    behavior.show();//show the view
    behavior.hide();//hide

    behavior.setMinScrollY(20)
    behavior.setScrollYDistance(100)
    behavior.setDuration(1000)
    behavior.setInterpolator(new LinearOutSlowInInterpolator());

Tips

1、Because the root layout is CoordinatorLayout, the toolbar may cover the item at the top of the recyclerView when used, and the bottom bar may also cover the bottom item. You can add a placeholder such as itemDecoration to the recyclerView, or a placeholder view at the top. If the situation is relatively simple, you can simply set padding, margin and so on. I have dealt with this kind of situation in the demo simply.

2、If the elevation of the floatingActionButton is greater than that of the bottomBar, the animation of the floatingActionButton will cover the top of the bottomBar, and vice versa.

Apk and More Info

For more usage, you can download or clone the demo. You can also download the demo apk.

License

Copyright 2017 Lauzy

Licensed 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 at

    http://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.

About

[NO LONGER SUPPORTED]Simple implementation of sliding animation of title bar, bottom bar and floatingActionButton.

Resources

Readme
Activity

Stars

603 stars

Watchers

10 watching

Forks

110 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.