How to create Custom Ratings bar in Android

前端 未结 13 1402
故里飘歌
故里飘歌 2020-11-22 06:28

Hello all i need to perform Ratings in my application... SO i need to create custom Ratings bar... Can Anyone Help me in this?

13条回答
  •  没有蜡笔的小新
    2020-11-22 07:14

    You can use @erdomester 's given solution for this. But if you are facing issues with rating bar height then you can use ratingbar's icons height programmatically.

    In Kotlin,

    val drawable = ContextCompat.getDrawable(context, R.drawable.rating_filled)
    val drawableHeight = drawable.intrinsicHeight
    
    rating_bar.layoutParams.height = drawableHeight
    

提交回复
热议问题