i have a shape in xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="8dip"
android:topRightRadius="8dip"
android:bottomLeftRadius="8dip"
android:bottomRightRadius="8dip"/>
</shape>
i want this shape to be the shape of a button. but when i declare:
button.setBackgroundDrawable(the shape)
i cannot afterwards change the button color. it's always gives me black background, and i want to change the color dynamically. i tried:
button.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
and it has no affect. thanks.