Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to change background tint color programmatically android

    Drawable buttonDrawable = button.getBackground();
    buttonDrawable = DrawableCompat.wrap(buttonDrawable);
    //the color is a direct color int and not a color resource
    DrawableCompat.setTint(buttonDrawable, Color.RED);
    button.setBackground(buttonDrawable);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #background #tint #color #programmatically #android
ADD COMMENT
Topic
Name
7+7 =