如何在姜饼和更低的设备上运行 api 级别 14 演示 [英] How to run the api level 14 demos on gingerbread and lower devices

查看:15
本文介绍了如何在姜饼和更低的设备上运行 api 级别 14 演示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 api 级别 14 从 Eclipse 创建一个新的 Android 示例项目时,添加兼容性库并尝试在我的姜饼设备上运行它.它给出了以下错误:

When I create a new Android Sample Project from eclipse with api level 14, add the compatibility library and try to run it on my gingerbread device. It gave the following error :

Error Inflating Class SwitchPreference 

我刚刚评论了首选项 xml 文件中的 SwitchPreference 并且能够运行 api 演示应用程序.但是 Fragment(和其他几个)演示不可用.

I just commented the SwitchPreference from the preferences xml file and was able to run the api demos app. But the Fragment(and few others) demos were not available.

这是预期的吗?我应该有一个运行 api-14 的设备才能看到 Fragment 演示吗?我在创建项目的过程中是否遗漏了什么?

Is this expected? should I have a device running api-14 to be able to see the Fragment demos? Am I missing anything in the process of creating the project?

感谢任何帮助.

推荐答案

兼容性库提供了 Fragment API,但它不会以某种方式将您的 API 级别 10 设备升级到 API 11 或 14.API 14 的示例项目可能使用兼容库未提供的片段以外的其他 API.此外,命名空间是不同的.如果您想在 Gingerbread 上运行它,您必须做一些工作才能将该示例移植回来.我会查看兼容性库中的示例.

The compatibility library provides the Fragment API, but it doesn't somehow upgrade your API level 10 device to API 11 or 14. The sample projects for API 14 probably use other APIs besides fragments that the compatibility library does not provide. Additionally, the namespaces are different. You'll have to do some work to port that sample back if you want to run it on Gingerbread. I would look in the samples in the compatibility library instead.

这篇关于如何在姜饼和更低的设备上运行 api 级别 14 演示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆