0

我在警报对话框内有一个线性布局以及其他视图。我已经设置了该线性布局的内容描述。仍然对讲焦点没有出现在它上面。但是当加载警报对话框时,它会读出其中所有视图的内容描述,包括这个线性布局。如何单独设置对讲可聚焦的线性布局?

4

1 回答 1

1

I've run into a similar problem recently.

  1. Make your target LinearLayout focusable by adding the following line to the XML:

    android:focusable="true"

  2. Use View.requestFocus() when the alert dialog opens to move focus to that LinearLayout.

There's a more detailed explanation in my original answer to Android: How to force Explore-By-Touch/Talkback to repeat the ContentDescription of the current View in AccessibilityFocus? which may provide some helpful additional information.

于 2014-09-01T14:22:01.257 回答