有什么方法可以在评级栏上拖动触摸时获取RatingBar android的当前值
我知道我可以这样做
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
Toast.makeText(view.getContext(), rating + " ", Toast.LENGTH_SHORT).show();
}
});
但我希望在更改时获得评分
答案 0 :(得分:2)
你可以试试这个
Name | Default | Changeable |
precision | "14" | PHP_INI_ALL |
这会在您触摸ini_set('precision', 17);
ExampleModel::find($id)->previous_value;
时获得评分,然后您可以将此值传递到ratingBar.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
float rating = ratingBar.getRating();
//todo: do stuff with 'rating' value
//...
return ratingBar.onTouchEvent(event);
}
});