Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Temporarily disable animation on Lollipop CheckBox

I have a ListView with rows that include CheckBoxes. This ListView has filtering behavior attached, which recycles those rows by setting new data (via a simple setData() method) as the filter criteria changes. When this occurs, any recycled row that has the checked state changed will update its CheckBox, which in turn triggers the Lollipop animation of the CheckBox being drawn in or out.

The ways in which this is distracting to the user are numerous. How can this animation be disabled temporarily when its state is programmatically updated?

like image 370
jneander Avatar asked Nov 23 '15 17:11

jneander


Video Answer


2 Answers

Try this

<CheckBox
    
    **android:background="@android:color/transparent"

    **android:clickable="false"

    android:id="@+id/login_access_tick"
    
    android:layout_width="wrap_content"
    
    android:layout_height="wrap_content"/>

Hope it helps.Thanks

like image 132
touhid udoy Avatar answered Oct 13 '22 23:10

touhid udoy


Calling jumpDrawablesToCurrentState() on your CheckBox right after calling setChecked will skip the animation.

like image 20
roelvogel Avatar answered Oct 13 '22 23:10

roelvogel