0

在我的xml中我设置了android:stepSize="1"但是当我实现它时。它仍然显示 1.0。

如何将其更改为1?

rtnCafe.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {

        @Override
        public void onRatingChanged(RatingBar ratingBar, float rating,
                boolean fromUser) {
             Log.i("rating",""+rtnCafe.getRating());
             Toast.makeText(getApplicationContext(), "rating " +rtnCafe.getRating(), Toast.LENGTH_LONG).show();
             txtLove.setText(""+rtnCafe.getRating());

        }
    });
4

2 回答 2

1

你可以把它投给int喜欢,

txtLove.setText(""+(int)rtnCafe.getRating());
于 2013-04-30T10:03:41.717 回答
1

只需在 rtnCafe.getRating(...

于 2013-04-30T10:04:18.597 回答