private void showInfoWindow(LatLng latLng, String address){
ViewGroup infoView = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.view_current_location,null);
TextView locationTextView = (TextView) infoView
.findViewById(R.id.view_current_location_info_textview);
locationTextView.setText(address);
Point p = baiduMap.getProjection().toScreenLocation(latLng);
p.y -= 20;
LatLng llInfo = baiduMap.getProjection().fromScreenLocation(p);
infoWindow = new InfoWindow(infoView,llInfo,0);//第一个参数为infowindow显示的view,第二个参数是显示的位置,第三个参数为Y轴的偏移量
baiduMap.showInfoWindow(infoWindow);
}
其中infowindow的view的布局只能是LinearLayout,如果用RelativeLayout会出现显示不全,不知道是什么原因