Answers for "how to change drawable icon color in textview android programmatically"

4

change color of text in textview android

TextView text = (TextView) findViewById(R.id.text);
text.setTextColor(Color.parseColor("#FFFFFF"));
Posted by: Guest on August-20-2020
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

Code answers related to "how to change drawable icon color in textview android programmatically"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language