我正在使用 TalkBack 测试我的应用程序的辅助功能兼容性。但是,某些 OutlinedTextFields 会被跳过,并且即使通过单击(如果启用了 TalkBack)也无法选择。我使用最新版本的 Kotlin/Gradle/Compose 创建了一个示例应用程序,以确保它与我的项目设置无关。
将“占位符”文本更改为某些值允许 TalkBack 选择,而其他值则使其不可选择(例如“MM/DD/YYYY”使 TalkBack 跳过该字段,但“Hello World”允许 TalkBack 选择该字段)。
代码如下:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
PlaygroundTheme {
// A surface container using the 'background' color from the theme
Column(
modifier = Modifier.fillMaxSize(),
) {
Greeting("Android")
OutlinedTextField(
value = remember{mutableStateOf("")}.value,
onValueChange = {
},
label = {
Text(text = "Date of Birth")
},
placeholder = {
Text(text = "MM/DD/YYYY") //TalkBack won't select the field with this …Run Code Online (Sandbox Code Playgroud) android accessibility selection textfield android-jetpack-compose