【问题标题】:how to add contentDesctiption to InfoWindow or marker in Android GoogleMaps V2 for TalkBack如何在 Android GoogleMaps V2 for TalkBack 中将 contentDesctiption 添加到 InfoWindow 或标记
【发布时间】:2017-04-05 21:14:51
【问题描述】:

我正在开发实现最新 GoogleMap API (V2) 的原生 Android 应用,我需要对其可访问性提出投诉(尽我所能)。

我可以将 contentDescription 属性添加到 mapView 并且它工作正常 - TalkBack 可以识别它。

但是,当我将相同的属性添加到标记或信息窗口的布局时,它会被 TalkBack 忽略。

似乎 GoogleMap 只是在内部将膨胀的布局呈现为位图,并在地图视图的顶部显示此位图,忽略 contentDescription 属性。因此,当点击相应的图片时,TalkBack 不会说任何内容。

任何人都有不同的经验或知识如何使用最新的 Googlemap 将 contentDescription 添加到 InfoWindow 或 Marker 中?

谢谢。

【问题讨论】:

  • 我怀疑这是 Maps V2 API 中的一个漏洞。您可能会考虑提交问题,因为地图团队非常擅长回应好的问题:code.google.com/p/gmaps-api-issues/issues/list
  • 谢谢,我就是这么做的。我仍然希望也许可以解决这个缺陷...... :-)
  • 你找到解决办法了吗?

标签: android google-maps accessibility infowindow talkback


【解决方案1】:

对于标记,我使用了marker.setTitile(),它有效,但仍然不知道如何使 InfoWindow 有效。

【讨论】:

    【解决方案2】:

    我们在一个旧项目中所做的是在收到标记单击回调时以编程方式构建并宣布内容描述。

    您可以查看 AccessibilityManager、AccessibilityRecordCompat 和 AccessibilityEvent。

    但目前 SDK 中不支持信息标记的焦点导航(左右或左右滑动导航)。焦点导航非常适合盲人使用。

    问候。

    【讨论】:

    • 他们目前是否添加了对焦点导航的任何支持?
    【解决方案3】:

    你的意思是设计一个新的信息窗口?你应该先写一个.xml布局文件,然后:

    map.setInfoWindowAdapter(new InfoWindowAdapter() {
            // Use default InfoWindow frame
            @Override
            public View getInfoWindow(Marker arg0) {
                return null;
            }
    
            // Defines the contents of the InfoWindow
            @Override
            public View getInfoContents(Marker arg0) {
                String namepic = arg0.getTitle();
                // Getting view from the layout file info_window_layout
                View v = getLayoutInflater()
                        .inflate(R.layout.info_window, null);
                LatLng latLng = arg0.getPosition();
                // Getting the position from the marker
    
                TextView tvtitle = (TextView) v.findViewById(R.id.tv_title);
                TextView tvLat = (TextView) v.findViewById(R.id.tv_lat);
                TextView tvLng = (TextView) v.findViewById(R.id.tv_lng);
                ImageView myimage = (ImageView) v.findViewById(R.id.my_image);
    
                tvtitle.setText(arg0.getTitle());
                tvLat.setText("Latitude:" + latLng.latitude);
                tvLng.setText("Longitude:" + latLng.longitude);
                // Returning the view containing InfoWindow contents
                myimage.setImageResource(getResources().getIdentifier(namepic,
                        "drawable", getPackageName()));
                return v;
            }
        });
    

    【讨论】:

    • 这与原始问题无关。
    猜你喜欢
    • 2014-05-02
    • 2013-03-31
    • 2014-03-29
    • 1970-01-01
    • 2021-05-28
    • 2012-12-31
    • 1970-01-01
    • 2012-12-02
    • 1970-01-01
    相关资源
    最近更新 更多