Issue
When my RadioButton is on the second page of my ViewPager (which is offscreen), it ends up looking like this when programmatically checked (in onViewCreated, onStart, and/or onResume)
Ideally, the radiobutton should look like this
How can I force the drawable to be in the correct state? I have tried invalidating the radio buttons but have had no luck. Clicking another radio button and re-clicking the correct one appears to fix the issue
Solution
After more testing, the issue appears to only be on API 25 and is caused by the animation that occurs when you click a RadioButton. I have fixed it by adding:
AnimatedStateListDrawable animatedStateListDrawable = (AnimatedStateListDrawable) radioButton.getButtonDrawable();
animatedStateListDrawable.jumpToCurrentState();
Answered By - Daiwik Daarun
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.