简体   繁体   English

带有ratingBarStyleIndicator主题且评分少于0.5的Android RatingBar

[英]Android RatingBar with ratingBarStyleIndicator theme and rating less 0.5

RatingBar with ratingBarStyleIndicator theme applied doesn't want to show values less than 0.5, it shows them as 0.5. 应用了ratingBarStyleIndicator主题的RatingBar不想显示小于0.5的值,而是将其显示为0.5。 But all is ok with greater values like 0.6..1. 但是,使用0.6..1等更大的值就可以了。 When style is default behavior is right. 当样式为默认时,行为正确。 Do you know the reason? 你知道原因吗?

I was having the same problem. 我遇到了同样的问题。 The behaviour seems to depend on a combination of the amount of transparent pixels around the 'star' image being used, and the device the app is running on (eg sometimes it doesn't go below 0.5 on the emulator, but goes to zero on my actual phone). 该行为似乎取决于所使用的“星形”图像周围的透明像素数量以及应用运行所在的设备(例如,有时在仿真器上它不会低于0.5,但在模拟器上变为0以下)我的实际电话)。

The workaround I found is to include a good chunk of blank space to the left of the ratingbar. 我发现的解决方法是在等级栏的左侧包含大量空白。 Eg try adding... 例如,尝试添加...

android:layout_marginLeft="10dp" 

...and if that works, experiment to see how much you can close up the gap and still get the reading down to zero. ...如果可行,请尝试看看有多少可以缩小差距,但仍可以将读数降至零。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM