android - What is the use of a ...-v21.xml? -
i developing app android version 4.0 , up. updated appcompat 22.2.0 seeing these references ...-v21 / v22.xml's on web. used for? make difference? in advance!
i had themes.xml in values-v21 folder
a res/values-v21/
directory contains resources used when device running app on api level 21 or higher. if device running on older version of android, res/values-v21/
directory ignored.
what used for? make difference?
they used provide different versions of resources different versions of android.
in case of themes.xml
file, api level 21+ device have theme inherits theme.material
. however, theme not exist on older devices. if have theme in res/values/
tries refer theme.material
, app crash on older devices. so, instead, put theme in res/values/
work on devices supporting (e.g., theme.holo
minsdkversion
of 11 or higher), , override theme in res/values-v21/
instead use theme.material
.
you can see in this sample app, theme.apptheme
(my app's theme) inherits theme.holo
in res/values/
, inherits theme.material
in res/values-v21/
. version of theme.apptheme
used @ runtime depends on version of android device has.
Comments
Post a Comment