Android - 星级评分栏

时间:2015-02-05 18:44:07

标签: android image rating

我正在使用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文件并查看了他的代码,似乎无法找到它。

非常感谢你的帮助:)

1 个答案:

答案 0 :(得分:1)

您需要保存评分。你只显示祝酒词。我不知道库的方法,但可能有一种方法可以改变活跃的星星。