本文介绍了如何将评级栏设置为至少一颗星?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要求对至少一颗星星的用户进行评分,然后再将评分提高到0.5。但我的问题是,用户不应将星级的最低评分更改为0.5或0。默认评分应为1。请对此提供帮助,并等待您的早日答复。我还尝试通过,但完全使用
中的逻辑进行构造我的代码是

I have a requirement to rate for a user with minimum of one star and after that ratings should increase to 0.5. But my question is that the user should not change the minimum rating of star to 0.5 or 0. 1 should be the default rating. Please help with this and awaiting for your earlier response. I also tried implementing by listeners from the link but completely struct with the logic insideMy code is:

ratingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {

    @Override public void onRatingChanged(RatingBar ratingBar, float rating, 
      boolean fromUser) {

    }
});


推荐答案

设置等级采用浮点值,
在案例ur的值是String:

Setting Rating takes float value ,in Case ur value is String :

ratingBar.setRating(Float.parseFloat(result));

这篇关于如何将评级栏设置为至少一颗星?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 03:34