GradientDrawable not working for android L

I have an ImageView and I am setting a gradient that can be extracted in setImageDrawable. This all works fine in android L

the problem starts when i change the dynamic color of the gradient then it will not reflect the color in the UI.

it worked fine until API 19 but got a break in android L
It works when setting the background from Drawable, but when you try to change the color from programming with GradientDrawable it doesn't work in Android L.

            GradientDrawable bgShapeRl = (GradientDrawable) mHolder.mRl_button
                    .getBackground();
            bgShapeRl.setColor(Color.parseColor("#f5f5f5"));
            GradientDrawable bgShape = (GradientDrawable) mHolder.mTxt_count
                    .getBackground();
            bgShape.setColor(Color.parseColor("#cbcbcb"));

      

+3


source to share





All Articles