Skip to content

Instantly share code, notes, and snippets.

@bastami82
Last active April 4, 2018 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastami82/ef5987b79353978223b74257f42c09c9 to your computer and use it in GitHub Desktop.
Save bastami82/ef5987b79353978223b74257f42c09c9 to your computer and use it in GitHub Desktop.
set drwabale icon backward compatible
import android.support.v7.content.res.AppCompatResources;
THE_VIEW.setBackgroundDrawable(AppCompatResources.getDrawable(ctx, R.drawable.ic_report_review);
//with drwable left
THE_VIEW.setCompoundDrawablesWithIntrinsicBounds(AppCompatResources.getDrawable(ctx, R.drawable.ic_report_review), null, null, null);
@bastami82
Copy link
Author

drawableImage = AppCompatResources.getDrawable(context, R.drawable.image);
or
drawableImage = VectorDrawableCompat.create(context.getResources(), R.drawable.image, context.getTheme());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment