Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TalkBack for SeekBar values

So I have a SeekBar in my app and I'm using the TalkBack function of Android. When the SeekBar is scrolled, the device says "(android:contentDescription of view), SeekBar control, 50%". Is it possible to change it so it says the actual value (from -4 to +4), like "SeekBar control, negative 4"?

like image 214
mugiwara528 Avatar asked Jan 09 '17 05:01

mugiwara528


2 Answers

If you're using a SeekBar, I figure you're tracking the value somewhere. In our case, there is a TextView above the SeekBar that displays the current value derived from the SeekBar's progress.

I've found that setting android:accessibilityLiveRegion="assertive" as an attribute for the TextView works perfectly. It results an an announcement of the updated value (since the TextView is update), followed by the SeekBar's progress.

Note: Setting android:accessibilityLiveRegion to assertive was appropriate for us because it's less time consuming for a user to rapidly change the SeekBar's progress. Setting it to polite announces every increment, while assertive skips unannounced increments to the most recent.

Example of what I'm talking about.

like image 161
Shalbert Avatar answered Sep 18 '22 11:09

Shalbert


Though not the perfect answer, I found this useful method: https://developer.android.com/reference/android/view/View.html#announceForAccessibility(java.lang.CharSequence)

Which basically makes the TalkBack function talk during a specific event. I added this in the OnSeekBarChangeListener to make it "talk" every time I change the value of the slider.

like image 38
mugiwara528 Avatar answered Sep 19 '22 11:09

mugiwara528