百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

FloatingView

> 编程语言
开源

FloatingView 可以使目标视图以炫酷的动画方式悬浮在锚视图上方

1.8K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

FloatingView 可以使目标视图以炫酷的动画方式悬浮在锚视图上方

FloatingView

FloatingView can make the target view floating above the anchor view with cool animation



Links ----- - [中文版 README](https://github.com/UFreedom/FloatingView/blob/master/README_CN.md) - [Blog about FloatingView](http://www.jianshu.com/p/6aaa258d77f1) - [demo.apk](http://oeapkptbn.bkt.clouddn.com/FloatingView-demo-v1.0.1.apk) Usage ----- ### Step 1 Add dependencies in build.gradle. ```groovy dependencies { compile 'com.ufreedom.uikit:FloatingViewLib:1.0.2' } ``` ### Step 2 Use FloatingBuilder to create a FloatingElement ```java FloatingElement builder = new FloatingBuilder() .anchorView(View) .targetView(View) .offsetX(int) .offsetY(int) .floatingTransition(FloatingTransition) .build(); ``` The use of FloatingBuilder can be configured to have: * anchorView :Anchor, is you want to float animation in which View above * target:Target, The view which you want to float * offsetX:X direction of offset, unit PX * offsetY: Y direction of offset, unit PX * floatingTransition : Floating effect, the default is ScaleFloatingTransition ### Step 3 Create a Floating as a FloatingElement container, and then let your View fly up ```java Floating floating = new Floating(getActivity()); floating.startFloating(builder); ``` Customisation ------------- ####1.Coordinates ####2.Class Diagram ####3.Floating Animation Implementation of floating animation is very simple, you only need to implement the [FloatingTransition][4] interface. ```java public interface FloatingTransition { public void applyFloating(YumFloating yumFloating); } ``` In the `applyFloating` method, you can use Android Animation to do the animation, and then use the [YumFloating][6] to do Alpha , Scale, Translate, Rotate and other transformations. If you want to add the [Facebook Rebound][5] animation effect, you can use the [SpringHelper][7], for example, [ScaleFloatingTransition][8]: ``` … ``` If [SpringHelper][7] can not meet your needs, you can directly use the `createSpringByBouncinessAndSpeed(double bounciness, double speed)` or `createSpringByTensionAndFriction(double tension, double friction)` to create the Spring, and then use `transition (Progress double, startValue float, endValue float)` for numerical conversion ####4.Floating Path Animation The floating path animation is also very simple, such as [CurveFloatingPathTransition][9], first you need to inherit from the [BaseFloatingPathTransition][10] class ,The difference is, you need to implement a `getFloatingPath (`) method. Use `Path` in the `getFloatingPath () `method to create the path you want to float, and then call `FloatingPath.create (path, false)` to return. For example, [CurveFloatingPathTransition][9] implementation: ``` … ``` Use Path to describe the path you want to float, and then in `applyFloating (YumFloating yumFloating)`: * Use `getStartPathPosition () ` method to obtain the starting position of the path * Use `getEndPathPosition () ` method to obtain the end position of the path * Use `getFloatingPosition(float progress)` to get the position of the current progress `getFloatingPosition(float progress)`method will return a `PathPosition` object, its properties x an y representing the current path animation x coordinates and Y coordinates. Release Log ----------- #### v1.0.2 [Fix bug](https://github.com/UFreedom/FloatingView/pull/6) #### v1.0.1 First Version License -------- Copyright 2015 UFreedom 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. [1]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/FloatingBuilder.java [2]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/FloatingElement.java [3]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/Floating.java [4]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/transition/FloatingTransition.java [5]:http://facebook.github.io/rebound/ [6]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/transition/YumFloating.java [7]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/spring/SpringHelper.java [8]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/effect/ScaleFloatingTransition.java [9]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/effect/CurveFloatingPathTransition.java [10]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/transition/BaseFloatingPathTransition.java

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •中文版 README
  • •Blog about FloatingView
  • •demo.apk
  • •anchorView :Anchor, is you want to float animation in which View above
  • •target:Target, The view which you want to float
  • •offsetX:X direction of offset, unit PX
  • •offsetY: Y direction of offset, unit PX
  • •floatingTransition : Floating effect, the default is ScaleFloatingTransition
  • •Use getStartPathPosition () method to obtain the starting position of the path
  • •Use getEndPathPosition () method to obtain the end position of the path

> 标签

Javaandroidanimationfloat-animationfloatingview

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言