[英]Android - Star Rating Bar
我正在使用badoo Star Bar,並且已經完成所有設置,並且可以預期當方法public void onFinalRating(int rating, boolean swipe) {
被調用時,我選擇的星星數量不會保持突出顯示,它返回默認狀態。 這是git hub https://github.com/badoo/StarBar上的倉庫
我的設置完全一樣,沒有做任何更改,但無論如何都可以,
這是我的布局
<com.badoo.mobile.views.starbar.StarBar
android:id="@+id/starBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
然后我在這里實現
mStarBar = (StarBar)findViewById(R.id.starBar);
mStarBar.setOnRatingSliderChangeListener(new StarBar.OnRatingSliderChangeListener() {
@Override
public boolean onStartRating() {
// The user has initiated a rating by touching the StarBar. This call will
// immediately followed by a call to onPendingRating with the initial rating
// value.
Toast.makeText(DiningDetailActivity.this, "Started rating", Toast.LENGTH_SHORT).show();
return true;
}
@Override
public void onPendingRating(int rating) {
// This method will first be called when the user initiates a rating and then
// subsequently as the rating is updated (by the user swiping his finger along
// the bar).
Log.i(TAG, Integer.toString(rating) + "");
}
@Override
public void onFinalRating(int rating, boolean swipe) {
// If the rating is completed successfully onFinalRating is called with the
// final result. The swipe parameter specifies if the rating was done using
// a tap (false) or a swipe (true).
Toast.makeText(DiningDetailActivity.this, "Final rating " + rating, Toast.LENGTH_SHORT).show();
}
@Override
public void onCancelRating() {
// Called if the user cancels the rating by swiping away from the StarBar and releasing.
}
});
所以我的問題是,當我選擇讓4個星星高亮顯示而不是轉回灰色狀態時,該如何選擇?
我查看了readME文件,並遍歷了他的代碼,但似乎找不到它。
非常感謝你的幫助 :)
您需要保存評級。 您只顯示吐司。 我不知道該庫的方法,但可能有一種更改活動恆星的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.