12

I'm working on native Android app which implements the latest GoogleMap API (V2), and I need to make it accessibility complaint (as much as I can).

I can add contentDescription attribute to the mapView and it works fine - TalkBack recognizes it.

However, when I add the same attribute to the layouts of the Marker or InfoWindow, it is just ignored by TalkBack.

Seems like GoogleMap just renders the inflated layout internally to a bitmap and shows this bitmap on the top of the mapview, ignoring contentDescription attribute. As a result, TalkBack doesn't say anything when the corresponding image is clicked.

Anybody has a different experience or knowledge how to add contentDescription to the InfoWindow or Marker with the latest Googlemap ?

Thanks.

user1512464
  • 341
  • 2
  • 6

3 Answers3

4

For marker, i used marker.setTitile() and it worked, still don't know how to make InfoWindow works.

Tan Tran
  • 166
  • 1
  • 6
0

What we did in an old project was to programmatically build and announce the content description when we receive the marker clicked callback.

You can check AccessibilityManager, AccessibilityRecordCompat and AccessibilityEvent.

But there is no focus navigation (navigate swiping left-right or right-left) support currently in the SDK for info markers. Focus navigation is very common for blind people to use.

Regards.

ArgBat
  • 33
  • 1
  • 6
-1

Do you mean design a new info window? You should first write a .xml layout file, then:

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;
        }
    });
Olivia Liao
  • 375
  • 3
  • 7