use*_*464 9 android google-maps accessibility infowindow talkback
我正在开发原生Android应用程序,它实现了最新的GoogleMap API(V2),我需要尽可能多地进行可访问性投诉.
我可以将contentDescription属性添加到mapView,它工作正常 - TalkBack识别它.
但是,当我将相同的属性添加到Marker或InfoWindow的布局时,TalkBack会忽略它.
似乎GoogleMap只是在内部将膨胀的布局呈现为位图,并在mapview的顶部显示此位图,忽略contentDescription属性.因此,当点击相应的图像时,TalkBack不会说任何内容.
任何人都有不同的经验或知识如何使用最新的Googlemap向InfoWindow或Marker添加contentDescription?
谢谢.
小智 -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;
}
});
Run Code Online (Sandbox Code Playgroud)