我正在开展一个大型项目,我们使用 TextView
来显示文本和提示 .
当使用对讲(可访问性)时,我注意到 TextView
上的提示被读取两次 .
即使 TextView
中有文本,仍然会读取提示 .
当我使用 EditText
时,只有第二个问题仍然存在(输入文本,仍然会读取提示) . 这似乎是正常的(但令人困惑的)Android行为,因为像PlayStore这样的Google-Apps也会这样做 .
但是为什么 TextView
读取提示两次,而 EditText
不是?
PS:我知道有可能从 TextView
切换到 EditText
,但由于我们使用的自定义视图严重依赖于 TextView
,因此这不是一个可行的选择 .
我也知道使用 label for
,但我更感兴趣的是技术背景为什么 TextView
读取提示两次 .
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="test"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>