change animateLayoutChanges property using java co

2019-04-18 12:39发布

I'm working on a android application which is use layout change animations. what i want to know is, is there any one know how to change the "andorid:animateLayoutChanges" proberty using java code.

my current value is

android:animateLayoutChanges="false"

I want to change it to "true" in activity onResume() method.

1条回答
一夜七次
2楼-- · 2019-04-18 13:26

Use setLayoutTransition() method in your code:

LayoutTransition layoutTransition = new LayoutTransition();
//or, if previously enabled in xml, use getLayoutTransition()

//enable animation
setLayoutTransition(layoutTransition);

//disable animation
setLayoutTransition(null);

source: Animating Layout Changes

查看更多
登录 后发表回答