开发者

Pretty Rating Bar: Indicator is still interactive

开发者 https://www.devze.com 2023-03-24 04:12 出处:网络
I created a custom-styled RatingBar per kozyr\'s instructions (http://kozyr.zydako.net/2010/05/23/pretty-ratingbar/). However, I want my RatingBar to be just an indicator, not interactive. The style I

I created a custom-styled RatingBar per kozyr's instructions (http://kozyr.zydako.net/2010/05/23/pretty-ratingbar/). However, I want my RatingBar to be just an indicator, not interactive. The style I defined has @android:style/Widget.RatingBar.Indicator as the parent, and the RatingBar displays properly. But the RatingBar can still be modified 开发者_Python百科by the user.

Any ideas to make the custom-styled RatingBar just an indicator?


I've been indecisive, but am submitting my answer as the accepted answer. I'm not sure of the appropriate protocol, but I believe my answer is the most correct, while setting enabled false is more of a hack, while certainly appropriate in some cases but could have unintended side effects other times.

It's apparently a bug: code.google.com/p/android/issues/detail?id=4520 When I added true to the style definition, the RatingBar was then an Indicator.


You could also set myRatingBar.setEnabled(false); to disable user interatction.


aha's comment did it for me. Just add true to your style.

ratingbar.setEnabled(false) just didn't do anything.

0

精彩评论

暂无评论...
验证码 换一张
取 消