android:如何禁用开关动画? [英] android : how to disable the animation of switch?

查看:33
本文介绍了android:如何禁用开关动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我正在使用名为 switch 的小部件.开关是 Android Studio 的默认小部件.问题是当我用开关添加新项目时,它的动画会运行,但我不想看到它.我在我的项目中使用了 ListView 和 Cursor Adapter.而 switch 是作为 ListView 元素的一个项目.你知道怎么解决吗?

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?

推荐答案

调用 jumpDrawablesToCurrentState() 将禁用动画,如果您在开关上调用 setChecked() 后立即调用它.

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

这篇关于android:如何禁用开关动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆