如何使用这两种DigitalClock和TextClock从API级别8至19的Andr​​oid设备? [英] How to use both DigitalClock and TextClock for android devices from API level 8 to 19?

查看:242
本文介绍了如何使用这两种DigitalClock和TextClock从API级别8至19的Andr​​oid设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从API级别8至19日,包含时钟为制造设备的应用。我试图把DigitalClock布局。而我得到的,因为API级别17,pcated这个班德$ P $推荐使用TextClock从Eclipse的消息。但是,当我把TextClock,我得到错误信息,因为分8层,如何解决这个问题呢?我应该建立两个不同的应用程序?

I'm making the application for devices from API level 8 to 19, that contains clock. I tried to put the DigitalClock to layout. And I get message from Eclipse that this class deprecated since API level 17, recommended to use TextClock. But when I put TextClock, I get error message, because min level is 8. How to solve this problem? Should I build two different applications?

推荐答案

选项#1:使用 DigitalClock RES /布局/ 文件和 TextClock RES /布局-V17 / 文件。在Java code,它操纵的时钟,看看哪些时钟实现您得到相应的小部件ID和分支。

Option #1: Use DigitalClock in res/layout/ files and TextClock in res/layout-v17/ files. In your Java code that manipulates the clocks, see which clock implementation that you get for your widget ID and branch accordingly.

选项2:尝试通过向反向移植 TextClock 使用它的源$ C ​​$ C 的,所以你可以创建自己的版本,工程回旧的API级别。

Option #2: Try to backport TextClock by using its source code, so you can create your own version that works back to older API levels.

选项#3:只要使用 DigitalClock 和希望,而这是德precated,,谷歌仍然会支持它

Option #3: Just use DigitalClock and hope that, while it is deprecated, that Google will still support it.

第4个选项:使用neither类,并创建自己的时钟执行

Option #4: Use neither class and create your own clock implementation.

这篇关于如何使用这两种DigitalClock和TextClock从API级别8至19的Andr​​oid设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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