I'm extending the class so I don't have to set all the styles every time I use it, but setting stroke width from my sub class doesn't work. Here's my complete class:
class CustomCircleProgressBar(context: Context, attributes: AttributeSet?) : CircleProgressBar(
context,
attributes
) {
constructor(context: Context) : this(context, null)
init {
setStyle(SOLID_LINE)
setProgressStartColor(getContext().getColor(R.color.colorAccent))
setProgressEndColor(getContext().getColor(R.color.colorAccent))
setProgressBackgroundColor(getContext().getColor(R.color.colorPrimaryLight))
setProgressTextColor(getContext().getColor(android.R.color.transparent))
setProgressStrokeWidth(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()))
}
}
the stroke remains 1dp thin.
Works correctly if set from xml: app:progress_stroke_width="5dp"
Other parameters are working correctly. It appears to me that the problem is due to initPaint() not being called after the new width is set.
Any way I can make it work?
I'm extending the class so I don't have to set all the styles every time I use it, but setting stroke width from my sub class doesn't work. Here's my complete class:
the stroke remains 1dp thin.
Works correctly if set from xml:
app:progress_stroke_width="5dp"Other parameters are working correctly. It appears to me that the problem is due to
initPaint()not being called after the new width is set.Any way I can make it work?