Android 覆盖包含图标和文本视图的线性布局的对讲文本
我基本上有:Android 覆盖包含图标和文本视图的线性布局的对讲文本,android,accessibility,Android,Accessibility,我基本上有: <MyCustomLinearLayout> <ImageView> <TextView> </MyCustomLinearLayout> 我想覆盖整个布局子结构的可访问性文本;当LinearLayout或它的任何一个孩子被拖走时,我想完全控制TalkBack说什么(这样我就可以让它说“3条评论”,而不是“评论图标3”) 我尝试了覆盖SendAccessibilityEventChecked,dispatchPopula
<MyCustomLinearLayout>
<ImageView>
<TextView>
</MyCustomLinearLayout>
我想覆盖整个布局子结构的可访问性文本;当LinearLayout或它的任何一个孩子被拖走时,我想完全控制TalkBack说什么(这样我就可以让它说“3条评论”,而不是“评论图标3”)
我尝试了覆盖SendAccessibilityEventChecked
,dispatchPopulateAccessibilityEvent
,requestSendAccessibilityEvent
等多种组合,但都没有成功,我在任何地方都找不到这种相当简单的设置示例。在布局中使用动态设置文本,并防止对讲读取子视图的内容
myText.setText(text);
. . .
myLayout.setContentDescription(imageDescription + " " + text);
由于是动态设置描述,因此可以在布局XML中将图像的内容描述设置为@null,以避免Lint错误
<ImageView
. . .
android:contentDescription="@null" />
也考虑看最近的Android开发者办公时间视频,它涵盖了这些主题和更多的内容。