I am developing an app for android version 4.0 and up. I just updated to appcompat 22.2.0 but I am seeing all these references to ...-v21 / v22.xml's on the web. What are they used for? Do they make a difference? Thanks in advance!
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
A
res/values-v21/
directory contains resources that will be used when the device that is running your app is on API Level 21 or higher. If the device is running on an older version of Android, theres/values-v21/
directory will be ignored.They are used to provide different versions of resources for different versions of Android.
In the case of a
themes.xml
file, an API Level 21+ device could have a theme that inherits fromTheme.Material
. However, that theme does not exist on older devices. If you have a theme inres/values/
that tries to refer toTheme.Material
, your app will crash on those older devices. So, instead, you put a theme inres/values/
that will work on all devices that you are supporting (e.g.,Theme.Holo
for aminSdkVersion
of 11 or higher), and override that theme inres/values-v21/
to instead useTheme.Material
.You can see that in this sample app, where
Theme.Apptheme
(my app's theme) inherits fromTheme.Holo
inres/values/
and inherits fromTheme.Material
inres/values-v21/
. Which version ofTheme.Apptheme
is used at runtime depends on what version of Android the device has.