“Android Studio SetbackgroundColor Drawable” Réponses codées

modifier la couleur dessinable programmatiquement 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))));


//

KushalCodes

Android Studio SetbackgroundColor Drawable

result.setBackgroundResource(R.drawable.your_drawable);
adreaskar

Comment changer le collot d'arrière-plan dessinable dans Android

sdgfdjjk
KushalCodes

Réponses similaires à “Android Studio SetbackgroundColor Drawable”

Questions similaires à “Android Studio SetbackgroundColor Drawable”

Plus de réponses similaires à “Android Studio SetbackgroundColor Drawable” dans Java

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code