动画布局 ILayoutAnimationController

码农软件 · 软件分类 · Android UI 组件 · 2019-04-23 18:57:24

软件介绍

自定义 LayoutAnimationController,可任意定制 ViewGroup 实例内部子 View 的动画执行顺序,1行代码就让你的ViewGroup拥有华丽的布局动画!     

使用方法

方法一:

首先创建 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) 方法无效!

本文地址:https://codercto.com/soft/d/4232.html

文明之光(第一册)

文明之光(第一册)

吴军 / 人民邮电出版社 / 2014-6-25 / 59.00元

人类的历史,是从野蛮蒙昧一步步走向文明进步的过程。在文明的进程中,人类创造出多元的文化,它们有着各自的特长。要实现人类和平发展的终极理想,一个重要的前提是承认文化的多元性,并且取长补短,相互融合。 吴军博士写作《文明之光》系列,希望能开阔人们的视野,让我们看到各种各样的人类文明。虽然今天不同的地区发达程度不同,文明历史的长短不一,国家亦有大小之分,但是文明之光从世界的每一个角落发出,对人类的......一起来看看 《文明之光(第一册)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

随机密码生成器
随机密码生成器

多种字符组合密码