2015-02-05 502 views
0

我使用的是badoo Star Bar,當調用方法public void onFinalRating(int rating, boolean swipe) {時,我已經設置好了所有設置和工作,我選擇的星星數量不會突出顯示,它會返回到默認狀態。這裏是git的樞紐https://github.com/badoo/StarBarAndroid - 星級酒吧

回購,我的設立是完全一樣的,並沒有改變什麼,但在這裏它是反正,

這是我的佈局

<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

正確,但我看不到一種方法,節省星星...你會介意快速瀏覽一下圖書館 – iqueqiorio 2015-02-05 20:06:58

+0

保存數據很容易,你可以自己做:)你可以使用sqlite數據庫或JSON對象:) – tR4xX 2015-02-05 20:08:45

+0

它不是關於保存價值,它的星星是否被突出顯示? – iqueqiorio 2015-02-05 20:15:16