2010-04-14 56 views
2

我有我的應用程序一的RatingBar,當我通過鼠標懸停在上面,我想,評級變化更改評分欄上的Android

我怎麼能這樣做?這是可能的?

最好的問候

+0

您是否將android:isIndicator設置爲false? – 2010-04-14 10:49:53

+7

我可以記住Android的第一個mouseover查詢。 – 2010-04-14 11:14:11

回答

10

在Android中沒有鼠標。

+1

Android確實支持鼠標或其他指針設備,儘管很少使用。 – StackOverflowed 2012-05-23 20:12:26

1

絕對沒有在Android的鼠標,但點擊事件,你可以在你的評級欄進行更改。

public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) { 
    final int numStars = ratingBar.getNumStars(); 
    mRatingText.setText( 
      getString(R.string.app_name) + " " + rating + "/" + numStars); 

    // Since this rating bar is updated to reflect any of the other rating 
    // bars, we should update it to the current values. 
    if (mIndicatorRatingBar.getNumStars() != numStars) { 
     mIndicatorRatingBar.setNumStars(numStars); 
     mSmallRatingBar.setNumStars(numStars); 
    } 
    if (mIndicatorRatingBar.getRating() != rating) { 
     mIndicatorRatingBar.setRating(rating); 
     mSmallRatingBar.setRating(rating); 
    } 
    final float ratingBarStepSize = ratingBar.getStepSize(); 
    if (mIndicatorRatingBar.getStepSize() != ratingBarStepSize) { 
     mIndicatorRatingBar.setStepSize(ratingBarStepSize); 
     mSmallRatingBar.setStepSize(ratingBarStepSize); 
    } 
}