I have a custom control extending SeekBar
, in which I have overridden onInitializeAccessibilityNodeInfo
as below:
@Override
public
I did something similar in Xamarin.Android in C#, but the code should be easy enough to port back to Java. Also, keep in mind these changes will override the initial talkback when the control is highlighted.
First on the textView that is keeping track of the value set:
textView.AccessibilityLiveRegion = AndroidViews.AccessibilityLiveRegion.Assertive;
Then I had to create my own custom AccessibilityDelegate
:
public class CustomSeekbarDelegate : Android.Views.View.AccessibilityDelegate
{
public override void OnInitializeAccessibilityEvent(AndroidViews.View host, AccessibilityEvent e)
{
//NOTE: Don't call base to prevent seekbar talkback percentage
}
}
seekBar.SetAccessibilityDelegate(new CustomSeekbarDelegate());
There's probably a way to keep both the initial spoken control accessibility when first highlighted, but there's not much online about it and this was good enough for our needs. Plus, I didn't have additional time to try and get that working as well.