Android Studio Kotlin – TransitionDrawable to a radius button-ThrowExceptions

Exception or error:

I have a button with this background:

 <shape xmlns:android=""
        <solid android:color="#FFFFFF"/>
        <corners android:radius="5dp"/>
        <stroke android:color="#E0E0E0"

When button is clicked it should change background color using TransitionDrawable:

val color = arrayOf<ColorDrawable>(ColorDrawable(Color.WHITE), ColorDrawable(getColor(R.color.myColor)))
val trans = TransitionDrawable(color)
quiz_rispsta_uno_button.background = trans

But on button click the radius disappear

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *