Issue
I was curious if there is a way to set the content description for each of the items in a drop down list? I'm using text input layout with Material Auto Complete Text View.
The reason is that I had a list of days but it's shortened and some devices don't say the whole day name when using talkback. For example I have "Tue", it should read Tuesday but it only reads "Tue". This is not true for all devices, for example pixel phones don't seem to have that issue.
Solution
You can implement your own Adapter and set necessary content description in a getView
function, something like this:
class ContentDescriptionArrayAdapter(
context: Context,
resource: Int,
items: Array<String>
) : ArrayAdapter<String>(context, resource, items) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = super.getView(position, convertView, parent)
view.contentDescription = "YOUR CONTENT DESCRIPTION"
return view
}
}
Answered By - Bracadabra
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.