Advantages
• TransformaGon
of
drawables
(states,
animaGon)
• Mix
mulGple
drawables
into
one
drawable
• Simple
shapes
support
• Fewer
asset
demands
• Reduces
APK
size
Slide 4
Slide 4 text
Short
Demo
Slide 5
Slide 5 text
basics
• Allows
you
to
draw
shapes
–
rectangles,
ovals,
lines
or
rings.
Slide 6
Slide 6 text
with
• Add
borders
with
Slide 7
Slide 7 text
with
• Rounded
corners
with
Slide 8
Slide 8 text
gradients
• Can
define
a
solid
color
with
or
a
gradient
with
Slide 9
Slide 9 text
• Lets
you
layer
drawables
on
top
of
each
other.
Slide 10
Slide 10 text
• Define
a
set
of
drawables
to
be
used
when
Views
are
in
different
states.
Slide 11
Slide 11 text
bu7on
Slide 12
Slide 12 text
Level-‐based
drawable
XML
• Drawables
have
levels
• ,
,
-‐
dynamic
changes
based
on
level
Slide 13
Slide 13 text
drawables
•
-‐
Explicit
list
of
drawables
for
each
level.
[…]
Slide 14
Slide 14 text
AnimaGon
Drawables
•
-‐
Cross-‐fades
between
two
drawables.
•
-‐
Frame-‐by-‐frame
animaGons.
Slide 15
Slide 15 text
and
• Both
let
you
adjust
how
the
image
is
rendered
•
-‐
gives
opGons
for
gravity
or
Gling.
Slide 16
Slide 16 text
Odds
and
Ends
•
-‐
insets
a
drawable
•
-‐
a
flat
color
•
-‐
Unsupported
Slide 17
Slide 17 text
Notable
• Compound
drawables
can
mix
and
match
any
number
of
other
drawable
XML
• All
drawable
XML
also
has
a
code
representaGon
–
e.g.,
a
gradient
is
a
GradientDrawable
Slide 18
Slide 18 text
Resources
• Official
Android
Docs:
h7p://developer.android.com/guide/topics/
resources/drawable-‐resource.html
• My
Drawable
XML
Docs:
h7p://idunnolol.com/android/drawables.html
• Sample
app
(source
for
demos):
h7ps://github.com/dlew/android-‐drawable-‐
xml-‐demo