From the course: Android App Development: Accessibility

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Custom views

Custom views - Android Tutorial

From the course: Android App Development: Accessibility

Start my 1-month free trial

Custom views

- [Instructor] In our simple application we have an example of a custom view. - [TalkBack Voice] Custom view button. Custom view. - [Instructor] This custom view is a very simple view which we just draw a text on top of it. Let's see the behavior with TalkBack enabled. - [TalkBack Voice] Custom view. Navigate custom. - [Instructor] As you can see, I cannot focus on this view. So how do I make it accessible for accessibility services such as TalkBack so I can focus and understand what it is? On Android Studio, let's go to the ui folder and open the SimpleCustomView. As you can see, this view is very simple which extends just a View and draws the text on the screen. Scroll down to the draw function and after that let's override another function called ownInitailizeAccessibilityNodeInfo so that we can provide the information to accessibility services. So hit Command + N and override and then override the ownInitailizeAccessibilityNodeInfo. Here in the info all we need to do is set the…

Contents