Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HuanHaiLiuXin/ILayoutAnimationController
Custom LayoutAnimationController/自定义LayoutAnimationController,一行代码搞定布局动画!
https://github.com/HuanHaiLiuXin/ILayoutAnimationController
Last synced: 2 months ago
JSON representation
Custom LayoutAnimationController/自定义LayoutAnimationController,一行代码搞定布局动画!
- Host: GitHub
- URL: https://github.com/HuanHaiLiuXin/ILayoutAnimationController
- Owner: HuanHaiLiuXin
- License: apache-2.0
- Created: 2017-03-09T12:07:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-18T03:46:42.000Z (over 6 years ago)
- Last Synced: 2024-08-02T01:18:47.787Z (6 months ago)
- Language: Java
- Homepage:
- Size: 6.87 MB
- Stars: 338
- Watchers: 7
- Forks: 42
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - ILayoutAnimationController - 一行代码搞定布局动画 (布局)
README
# ILayoutAnimationController
自定义LayoutAnimationController,可任意定制ViewGroup实例内部子View的动画执行顺序,1行代码就让你的ViewGroup拥有华丽的布局动画!
[**简书:Android开源之ILayoutAnimationController,1行代码让你的ViewGroup拥有华丽的布局动画!**](http://www.jianshu.com/p/f0e563a564f5)
***### 截屏GIF:
![](https://github.com/HuanHaiLiuXin/ILayoutAnimationController/blob/master/Screenshots/ILayoutAnimationController%E5%BD%95%E5%B1%8F.gif)### 使用方法:
###### 方法一:首先创建ILayoutAnimationController实例,然后将此实例作为参数为ViewGroup设置布局动画- 1:{@link ILayoutAnimationController#generateController(Animation, float, ILayoutAnimationController.IndexAlgorithm)}
- 2:{@link android.view.ViewGroup#setLayoutAnimation(LayoutAnimationController)}
###### 方法二:1行代码直接搞定,以下两种方法任选
- {@link ILayoutAnimationController#setLayoutAnimation(ViewGroup, int, float, ILayoutAnimationController.IndexAlgorithm)}
- {@link ILayoutAnimationController#setLayoutAnimation(ViewGroup, Animation, float,ILayoutAnimationController.IndexAlgorithm)}
### 示例代码:
```
LinearLayout ll = (LinearLayout) findViewById(R.id.ll);
//两行代码设置布局动画:
ILayoutAnimationController controller = ILayoutAnimationController.generateController(AnimationUtils.loadAnimation(this,R.anim.activity_open_enter),0.8f,ILayoutAnimationController.IndexAlgorithm.INDEXSIMPLEPENDULUM);
ll.setLayoutAnimation(controller);//一行代码直接搞定:
ILayoutAnimationController.setLayoutAnimation(ll,R.anim.activity_open_enter,0.8f,ILayoutAnimationController.IndexAlgorithm.INDEXSIMPLEPENDULUM);方法setLayoutAnimation中各参数介绍:
/**
* 根据传入的动画资源ID、单个子View动画延时、子View动画执行顺序算法枚举值 创建一个新的CustomLayoutAnimationController实例,
* 将此实例作为参数为viewGroup设置布局动画
* @param viewGroup
* @param animResId
* @param delay
* @param indexAlgorithm
*/
public static void setLayoutAnimation(@NonNull ViewGroup viewGroup,@AnimRes int animResId, float delay,@Nullable final IndexAlgorithm indexAlgorithm){
Animation animation = AnimationUtils.loadAnimation(viewGroup.getContext(),animResId);
setLayoutAnimation(viewGroup,animation,delay,indexAlgorithm);
}
```### 注意:
- *使用ILayoutAnimationController获取的ILayoutAnimationController实例,调用setOrder(int order)方法无效!*### 开发者:
**幻海流心**
**Email:** [email protected]
**简书:** http://www.jianshu.com/users/5702e6847f31/latest_articles
**GitHub:** https://github.com/HuanHaiLiuXin