Is there any way to convert a ViewGroup into a button for accessibility?

344 views Asked by At

I have a custom view with four Textview inside a constraint layout.
The problem is that i´m implementing accessibility, and this view must be a child of some kind of button, to inherit the behavior of "..., Button" sayd by Talkback. Is there a way to convert a view to type Button? Or any way to make the talkback recognize this view as a Button?

My xml is like this:

<ConstraintLayout>
  <CustomViewGroup>
    <AppCompatTextView>
  </CustomViewGroup>
  <CustomViewGroup>
    <AppCompatTextView>
  </CustomViewGroup>
  <CustomViewGroup>
    <AppCompatTextView>
  </CustomViewGroup>
  <CustomViewGroup>
    <AppCompatTextView>
  </CustomViewGroup>
  <View>
</ConstraintLayout>
1

There are 1 answers

1
Filipe Oliveira On

Your customview should extend "Button" class. Or you can use contentDescription. On each text view, add a content description with the text you wish (like: "action one button")