Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android : how to disable the animation of switch?

Tags:

android

widget

Recently,I am using the widget named switch. The switch is default widget of Android Studio.The problem is that when I add new Item with switch,its animation will run but I don't want to see it. I used ListView and Cursor Adapter in my project.And the switch is a item as an element of ListView. Do you know how to solve it?

like image 736
Little pupil Avatar asked Oct 16 '25 03:10

Little pupil


1 Answers

Calling jumpDrawablesToCurrentState() will disable the animation, if you call it immediately after calling setChecked() on the switch.

like image 179
comp500 Avatar answered Oct 18 '25 20:10

comp500