12

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

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

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

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

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

谢谢。

4

3 回答 3

3

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

于 2015-12-07T10:29:24.507 回答
0

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

您可以检查 AccessibilityManager、AccessibilityRecordCompat 和 AccessibilityEvent。

但目前 SDK 中不支持信息标记的焦点导航(左右或左右滑动导航)。焦点导航对于盲人来说非常普遍。

问候。

于 2017-04-05T13:14:51.317 回答
-1

你的意思是设计一个新的信息窗口?您应该首先编写一个 .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;
        }
    });
于 2015-05-29T02:53:43.693 回答