Answers for "how to make color from drawable android"

1

change drawable color programmatically android

//resource
Drawable unwrappedDrawable = AppCompatResources.getDrawable(context, R.drawable.my_drawable); 
Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, Color.RED);    

//activity
Drawable unwrappedDrawable = tvContinue.getBackground();
Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, (Color.parseColor(getPreferences().getString(Constant.SECOND_COLOR, Constant.SECONDARY_COLOR))));

//adapter
Drawable unwrappedDrawable = holder.tvOff.getBackground();
 Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
 DrawableCompat.setTint(wrappedDrawable, (Color.parseColor(((BaseActivity) activity).getPreferences().getString(Constant.SECOND_COLOR, Constant.SECONDARY_COLOR))));


//
Posted by: Guest on August-19-2020
0

how to change color of drawable in android

Drawable unwrappedDrawable = tvContinueShopping.getBackground();
        Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
        DrawableCompat.setTint(wrappedDrawable, (Color.parseColor(getPreferences().getString(Constant.SECOND_COLOR, Constant.SECONDARY_COLOR))));
Posted by: Guest on January-21-2021

Code answers related to "how to make color from drawable android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language