2015-02-05 254 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