android - Difference between DrawableCompat and Drawable -
a couple of days ago support library version v22.1.0 released , among new things have seen drawablecompat.
now question difference between drawablecompat , normal drawable, benefits bring , when , how use it.
i have read chris banes' blog, lacking explain , how useful developers.
quoting blog post in question:
the drawable tinting methods added in lollipop super useful letting dynamically tint assets.
here, tinting refers theme.material
/theme.appcompat
approach of using grayscale drawables , applying tints, colorprimary
or coloraccent
, tie them custom theme app. used in lots of places, in particular many places accent color seen.
continuing blog post:
appcompat had own baked in implementation in v21 support library , we’ve extracted drawablecompat in support-v4 use.
hence, drawablecompat
allows use tint-the-grayscale image appcompat-v7
does, tinting drawables, going api level 4. in contrast similar tinting methods available on drawable
starting api level 21. in particular, if creating custom widgets and using appcompat-v7
, might use drawablecompat
allow widgets adopt app's color scheme.
what difference between drawablecompat , normal drawable
drawablecompat
departs typical ...compat
approach. classes notificationcompat.builder
replacements progenitors (e.g., notification.builder
). in case, drawablecompat
applies changes, tint, drawable
, other drawable "wrapped" drawablecompat
. drawablecompat
provides api , wrap/unwrap capabilities; drawable
wrap()
use in app, in lieu of using original grayscale drawable
started with.
Comments
Post a Comment