I have an activity which adds a custom view to the entire activity's view using the following code
activity.getWindow().getDecorView()).addView(newView)
in order to have a screen of coach marks/usertips displayed.
My custom view extends from RelativeLayout and in its constructor a button is added at the bottom of the screen which when clicked upon dismisses the view.
I have overwritten the "dispatchDraw" method so that I can add multiple coachmark UI objects (textviews and bitmaps) to the layout at specific locations. These coachmark objects draw themselves on the view using code such as the following
canvas.save();
canvas.translate(positioning[0], positioning[1]);
textView.draw(canvas);
canvas.restore();
canvas.save();
canvas.drawBitmap(bitmap, positioning[2], positioning[3], new Paint());
canvas.restore();
ISSUE: When TalkBack is enabled
- when this coach mark view is displayed nothing is read out loud for this view
- If the user presses where the textviews and bitmaps are, nothing is read out loud
however when the user presses on the button the button's contentDescription is read out loud.
I assume the reason the textViews and Bitmaps are not read out is due to the way they are rendered on the canvas by my code above.
QUESTION 1: Is there a way to get the TalkBack to say something out loud when the textview and bitmaps are clicked upon? - I have tried setting contentDescriptions and focusable for the textviews and bitmaps but this does not make any difference.
QUESTION 2: An alternative is to get TalkBack to read out something when the custom view is displayed and this text can summarize all the coachmarks displayed in the screen. I can not work out how to do this, does anyone have any suggestions? - I have tried setting my customView to be focusable (setFocasable(true) and give it a contentDescription but this does not work. - I have tried instigating an action when the custom view is drawn and then adding a content description to the event but this does not work either, i.e.
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
}
@Override
public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
// this is not read out load when the view is displayed, but is read when the view is pressed
info.setContentDescription("on Initialize Accessibility Node Info User Tips");
}