[英]Customize RatingBar stars differently
我正在尝试自定义RatingBar
每个星星以使其看起来不同。
当我查看它的源代码RatingBar或其超类AbsSeekBar / ProgressBar 时,我无法识别这样的选项,它只能提供整个视图的进度/次要进度和背景。 最接近的是使用 thumbDrawable,但它的效用完全不同(对于不确定的SeekBar
)。
除了做一个完全自定义的视图来复制这样的功能之外,还有什么选择吗?
我不得不提一下,每颗星星(最后选择的星星)都有不同的“面孔”,并且总是恰好有 5 颗星( numStars
属性)。 任何想法都非常感谢!
您可以使用SmileView为每个评分值提供具有不同可绘制对象的评分视图,并且还基于badoo 的 StarBar 视图
用法
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
...
<com.eugeneek.smilebar.SmileBar
android:id="@+id/starBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:smileWidth="50dp"
app:smileHeight="50dp"
app:smileDefault="@drawable/none"
app:smileRate1="@drawable/one"
app:smileRate2="@drawable/two"
app:smileRate3="@drawable/three"
app:smileRate4="@drawable/four"
app:smileRate5="@drawable/five"
app:horizontalSpacing="8dp"
app:rating="1"
app:enabled="true"/>
...
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.