Reputation: 381
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"?
Upvotes: 7
Views: 3406
Reputation: 1154
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.
Upvotes: 8
Reputation: 381
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.
Upvotes: 2
Reputation: 3210
Yes, Its possible.
You said its showing "SeekBar control, 50%" means you are getting percentage.
So, use this percentage to achieve you goal:
int minValue = -4;
int maxValue = 4;
int diff = maxValue - minValue;
int realProgress = minValue + (diff * percentage / 100);
realProgress is your answer.
Hope it will help you!
Upvotes: -5