TextView :
<Element Text> <Element Action(if added)>
This is not mandatory to set contentDescription here , if some thing is required to announce , which is different from the mentioned in text string , so in that case contentDescription should be added , take a look :
Case -I
In this case , it will only announce : "This is Accessibility demo!"
If contentDescription is not mentioned : "Hello World!"
Case -II
In this case , it will only announce : "This is demo! , double tap to activate"
Here , double tap to activate , will also announced because clickable="true" has been added.
In case of ImageView :
It is mandatory to mention the content description , for imageview , it should be the well-descriptive and convey the correct information of that image.
If in any imageview , content description is not added , it will show the fail result , in accessibility scanner /axe tool .
So if in any imageview , it is not required to announce anything , so in that content description can set it to "@null"
Here is an example :
Here we can see that , in imageView2 , the my profile description has been added , but in imageView3 , it will not announce anything as contentDescription is set to @null .
<Element Text> <Element Action(if added)>
- Minimum text size must be 14sp
- 48 dp is the recommended touch target size for elements according to Google (height and width, with an 8 dp margin around the element).
This is not mandatory to set contentDescription here , if some thing is required to announce , which is different from the mentioned in text string , so in that case contentDescription should be added , take a look :
Case -I
<TextView android:text="Hello World!" android:contentDescription="This is Accessibility demo!" />
In this case , it will only announce : "This is Accessibility demo!"
If contentDescription is not mentioned : "Hello World!"
Case -II
<TextView android:text="This is demo!" android:clickable="true" />
In this case , it will only announce : "This is demo! , double tap to activate"
Here , double tap to activate , will also announced because clickable="true" has been added.
In case of ImageView :
It is mandatory to mention the content description , for imageview , it should be the well-descriptive and convey the correct information of that image.
If in any imageview , content description is not added , it will show the fail result , in accessibility scanner /axe tool .
So if in any imageview , it is not required to announce anything , so in that content description can set it to "@null"
Here is an example :
<ImageView android:id="@+id/imageView3" android:contentDescription="@null" app:srcCompat="@mipmap/ic_launcher" /> <ImageView android:id="@+id/imageView2" android:contentDescription="my profile" app:srcCompat="@mipmap/ic_launcher" />
Here we can see that , in imageView2 , the my profile description has been added , but in imageView3 , it will not announce anything as contentDescription is set to @null .
No comments:
Post a Comment