相关疑难解决方法(0)

更改没有动画的切换状态

在我的Android项目中,我有一个ListView包含SwitchCompat项目的行(AppCompat for Switchwidget).

当我滚动到列表并使用视图调用getView(...)方法时,我的问题发生.我重新定义了正确的状态,但动画是可见的.MyAdapterrecycledSwitch

在这种情况下有一个防止动画的解决方案?

在此输入图像描述

android android-listview android-switch

30
推荐指数
3
解决办法
9391
查看次数

如何在 Android 上加速或关闭 RadioButton 的动画?

我有一个带有动态添加的 RadioButtons 的 RadioGroup。在我的活动中,我在选择 RadioButton 后立即关闭活动。然而,这会导致一个工件,其中两个 RadioButton 看起来像是在 Activity 完成之前被选中。当 Activity 完成时,上一个选择和当前选择仍然是动画。

有没有办法加速动画或完全禁用它,这样我就看不到这个视觉工件?

radioButton.setChecked(true);   // previous selected button is still deselecting and current button is now selecting. both are in the middle of animating but activity closes before they can finish animating  
finishWithResult(selected == null ? Activity.RESULT_CANCELED : Activity.RESULT_OK, selectedItem);
Run Code Online (Sandbox Code Playgroud)

android android-radiogroup android-radiobutton

5
推荐指数
1
解决办法
561
查看次数