Reputation: 1164
In the material design guide there is a section called "Display processing status" where we see a video of a Switch with a progress indicator on the thumb.
https://material.io/design/components/selection-controls.html#switches
Because a switch shows the actual status of something, sometimes there is a delay in its change of state. In such cases, a processing status animation can be used.
A processing status is an animation on the thumb of the switch. For example, it can be used when a switch that controls a hardware feature experiences a delay before its final status can be confirmed.
How can I achieve such an effect? is that part of the normal CompatSwitch? Is there a library that does this?
Upvotes: 5
Views: 1130
Reputation: 7968
However, I think that video is just to demonstrate 'DO NOT DO THIS'. Because it clearly says
Don't demonstrate status by animating the thumb of a switch.
Upvotes: 0
Reputation: 1141
This is just an idea that may help you. You can use the custom image/drawable inside switches with help of switch thumb
property
<Switch
android:id="@+id/switch_one"
. . .
android:track="@drawable/switch_track_custom"
android:thumb="@drawable/switch_thumb_custom"/>
For state change, you can use Selecter
. this blog gives you a good idea.
Here are some other blog and libraries
Upvotes: 6