Android - 资源xml文件适配不同的版本

资源xml文件适配不同的版本


本文地址:http://blog.csdn.net/caroline_wendy


Adapt layout to Android platform or API level:把布局文件适配不同的API级别,避免警告;
通过为不同的API等级,建立不同的文件夹(layout-v4),进行适配,可以去掉Warning.

具体:
If what you‘re trying to do is show a different layout depending on which API version is available on the device, you want to use configuration qualifiers. The specifics for alternative resources are also documented.

The most basic way to do it is to create a layout folder for each API level you want to use, formatted as follows:

res/layout/mylayout.xml       (Default)
res/layout-v4/mylayout.xml    (Android 1.6)
res/layout-v11/mylayout.xml   (Android 3.0)
and so on, where vN is the API level. The specific API levels can be found on this page.


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。