change animateLayoutChanges property using java code

北慕城南 提交于 2019-12-06 16:54:11

问题


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:


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



来源:https://stackoverflow.com/questions/20741091/change-animatelayoutchanges-property-using-java-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!