我将评级值设为float,但我想在infowindow中将该值显示为ratingbar。
答案 0 :(得分:0)
public View getInfoContents(Marker marker){
String snippet1 = marker.getTitle();
String var = snippet1.substring(6, 9);
try {
if (!var.equals(null)) {
ratingBar1.setRating(Float.parseFloat(String.valueOf(var)));
} else {
Toast.makeText(getBaseContext(), "no ratings", Toast.LENGTH_SHORT).show();
}
} catch (NumberFormatException e) {
System.out.print("no ratings!!!");
}
LatLng ll = marker.getPosition();
placename.setText(marker.getTitle());
tvlat.setText("Longitute" + ll.latitude);
tvlng.setText("Longitute" + ll.longitude);
snippet.setText(marker.getSnippet());
return v;
}
});