在我的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());
}
});
答案 0 :(得分:1)
您可以将它转换为int
喜欢,
txtLove.setText(""+(int)rtnCafe.getRating());
答案 1 :(得分:1)
只需在rtnCafe.getRating(...
之前添加(int)