我想从markeroptions.snippet获取评级值,并在infowindow的评级栏上显示评级

时间:2016-04-22 13:40:42

标签: android

我将评级值设为float,但我想在infowindow中将该值显示为ratingbar。

1 个答案:

答案 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;

        }
    });