【问题标题】:Google pre-launch report - Multiple items have the same descriptionGoogle 发布前报告 - 多个项目具有相同的描述
【发布时间】:2020-08-19 09:03:55
【问题描述】:

现在,当应用的新 Beta 版上传到 Play 商店时,Google 会提供“发布前报告”。我上一份发布前的报告包含一个完整的对话框,里面充满了“多个项目具有相同的描述”。我现在已经找出了在我的情况下是什么导致了问题和我的解决方案。仍然显示问题的对话框的简化布局如下:

<?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>

Google 文档建议安装 TalkBack 和 Accessibility Scanner,这使我能够测试和重现问题。解决方案记录如下。

【问题讨论】:

    标签: android accessibility android-dialog android-accessibility


    【解决方案1】:

    解决方案在于添加

    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 会查看两者并认为描述相同。这是辅助功能扫描器中的错误吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-27
      • 1970-01-01
      • 1970-01-01
      • 2021-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-16
      相关资源
      最近更新 更多