谷歌推出前的报告--多个项目有相同的描述。

问题描述 投票:0回答:1

现在,当一个新的测试版应用上传到Play Store时,谷歌会提供一份 "预启动报告"。我上一次的Pre-Launch报告包含了一个完整的对话框,里面充满了''。多个项目有相同的描述'. 现在我已经找到了问题的原因,以及我的解决方案。以下是我的对话框的简化布局,但仍然显示出问题。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="fill_parent">
   <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">
      <LinearLayout
         android:id="@+id/displayHeightLayout"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
         <TextView
            android:id="@+id/displayHeightLbl"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="@string/displayInfoEms"
            android:labelFor="@id/displayHeight"
            android:text="@string/displayHeightLbl" />
        <TextView
                android:id="@+id/displayHeight"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ems="@string/displayInfoEms" />
      </LinearLayout>
      <Button
         android:id="@+id/displayInfoOkBtn"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:onClick="dismissDisplayInfos"
         android:text="@string/btnOk" />
   </LinearLayout>
</ScrollView>

谷歌文档建议安装TalkBack和Accessibility Scanner,这使我能够测试和重现这个问题。下面是解决方案的文档。

android accessibility android-dialog android-accessibility
1个回答
0
投票

解决方案在于添加

android:importantForAccessibility="no"

到第二个TextView的定义,如下所示。

        <TextView
                android:id="@+id/displayHeight"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:importantForAccessibility="no"
                android:ems="@string/displayInfoEms" />

我假设报告的原因是第一个TextView包含了一个... android:labelFor 属性,指的是第二个TextView,而无障碍扫描器会查看这两个文本,并认为描述是一样的。这是否是 Accessibility Scanner 的一个错误?

© www.soinside.com 2019 - 2024. All rights reserved.