how to change color of drawable in android

Solutions on MaxInterview for how to change color of drawable in android by the best coders in the world

showing results for - "how to change color of drawable in android"
Clelia
16 Jan 2017
1
2//resource
3Drawable unwrappedDrawable = AppCompatResources.getDrawable(context, R.drawable.my_drawable); 
4Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
5DrawableCompat.setTint(wrappedDrawable, Color.RED);    
6
7//activity
8Drawable unwrappedDrawable = tvContinue.getBackground();
9Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
10DrawableCompat.setTint(wrappedDrawable, (Color.parseColor(getPreferences().getString(Constant.SECOND_COLOR, Constant.SECONDARY_COLOR))));
11
12//adapter
13Drawable unwrappedDrawable = holder.tvOff.getBackground();
14 Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
15 DrawableCompat.setTint(wrappedDrawable, (Color.parseColor(((BaseActivity) activity).getPreferences().getString(Constant.SECOND_COLOR, Constant.SECONDARY_COLOR))));
16
17
18//
19
20
Erica
05 Aug 2019
1Drawable unwrappedDrawable = AppCompatResources.getDrawable(context, R.drawable.my_drawable); 
2Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
3DrawableCompat.setTint(wrappedDrawable, Color.RED);  
Lalie
13 Sep 2019
1 Drawable unwrappedDrawable = tvContinueShopping.getBackground();
2        Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
3        DrawableCompat.setTint(wrappedDrawable, (Color.parseColor(getPreferences().getString(Constant.SECOND_COLOR, Constant.SECONDARY_COLOR))));
4
queries leading to this page
android drawable background colorandroid set drawable color programmaticallyandroid drawable set background colorandroid drawable colerandroid programmatically change drawable tinthow to change color of a drawable in android programmaticallychange drawable tint color programmatically androidchange colour of 40android 3adrawable 2fedit box backgroundchange drawable image color in androidandroid change color of shape drawable programmaticallychange color of shape drawable androidchange color of drawable programmatically androidandroid color drawabledynamic color gives in drawable androidset colorfilter kotlinandroid drawable color from black to whitehow to change color of drawable image in android studioandroid studio change background color to drawable programmaticallyset color programmatically android from drawableandroid studio drawable colorchange drawable solid color programmatically androidhow to set drawable right tint color programmatically in androidcolor drawable in androidset drawable tintandroid studio change drawable from black to whitechanging drawable color androidget color from drawable androidhow to change text drawable tint color in android programmaticallyandroid create color drawable programmaticallyhow to make color from drawable androidchange drawable color in xml androiddrawable change color programmaticallyandroid color drawable programmaticallyandroid programmatically change drawable colorhow to change icon tint programmatically androidchange drawable color programmaticallyhow to set background color of a drawable in android programmaticallykotlin set color filterset drawable color androidhow to make color from drawable android xmlchange background color of drawable androidchange drawable color android programmaticallyuse color in drawable androidchange color of android drawaleandroid change textview drawable color programmaticallyandroid change drawable image color xmlcolor primary drawable androidcolor drawable android studioset background colour using drawables in androidandroid compound drawable change color programmaticallyhow to change drawable end tint color in android programmaticallyandroid studio change drawable image colorhow to set font colour in android drawablesandroid drawable with different colordrawable tint programmaticallyandroid change drawable color programmaticallyhow to change drawable color programmatically in androidhow to create drawable with 2 colors in androidset drawable tint programmatically androidcolors drawable kotlin with shadesandroid get color drawable programmaticallydrawable color to text color androidhow to set drawable end tint color programmatically in androidandroid get color as drawabledrawable apply color androidsetbackground tint to drawable androiddrawable image color androidhow to change drawable icon color in textview android programmaticallydrawable only set color android studiokotlin change drawable colorhow to get color from drawable androidandroid color to drawableget color of drawable androidset drawable color programmatically androidandroid drawable change colorandroid drawable use directly colorcolor drawable androidandroid imageview drawable change colorhow to set dynamic color in android drawable fileandroid drawable to detcolorhow to change color of drawwable resource in adapterhow to change drawable color dynamically in androidandroid change drawable colorandroid change drawable shape color programmaticallyandroid set color drawablechange drawable color by id programmatically android kotlinhow to set color as drawable in android programmaticallyhow to change drawable file background color in android programmaticallyandroid studio change color of drawablehow to convert color to drawable in androidhow to change background drawable color in android programmaticallysettintlist from drawable colorhow to create color xml in drawable android studiohow to change tint of a drawable in androidandroid studio color drawablecolor to drawable androidchange color button in android studio using drawableuse color in drawable android xmlset background drawable tint programmatically androidhow to get drawable strok color in androidchange drawable icon tint runtime androidhow to change colour of progress bar in androidandroid tint background drawablehow to change drawable tint color in android programmaticallyget color as drawable program androidhow to set background color in drawable android studiohow to change drawableleft color in android programmaticallyandroid set background drawable color programmaticallyandroid layer drawable change colorhow to set drawable tint color programmatically in androidcolor filter drawable androidandroid create drawable from color intandroid change icon color programmaticallyhow to create drawable color in androidandroid create color drawable programmatically from colorchange colored pixels of drawable androidandroid drawable change text colorhow to change drawable icon color in android programmaticallyhow to change drawable shape color in android programmaticallyhow to change drawable color in android programmaticallyconvert color code to drawable android studioandroid how to change drawablestart colorchange color of drawable androiddrawable android colordrawable change color programmatically kotlinpass color to a drawable android studiochange drawable icon runtime androiddrawable to color androidshift color of drawable androidandroid studio change color of all drawablesandroid 3adrawable 3d 22 40android 3acolor 2fwhite 22 colorsandroid how to change drawable colorchange drawable color programmatically android kotlinset left drawable color androiddrawable from color androidhow to change drawable end tint color programmatically in androiddrawable to text color android android drawable fill colorandroid studio change drawable color programmaticallyget drawable from color androidhow to change vector drawable color in androidchange color of drawable android programmaticallychange drawable color programmatically androidset color for drawable androidset drawable background color programmatically androidandroid drawable colorsandroid how to change drawable solid color programaticallychange a drawable color programmatically androidandroid change background drawable color programmaticallyandroid drawable change color when themechange only colored pixels of drawable androidchnage the stroke color of drawable in androidhow to reference color using attr in drawable file in androidchange color to drawable androidandroid drawable to colorhow to set in drawable dynamic color in androidandroid drawable color programmaticallyitem android drawable colorandroid how to get color drawabledrawable color androidandroid change icon color programmatiquellyandroid drawable dynamic colorset background tint drawable androidhow to change color of drawable in androidandroid fab drawable colorhow to change color of drawable in android