简体   繁体   English

“不推荐使用TabActivity类型”对于应用程序选项卡

[英]“The type TabActivity is deprecated” For app tab

"The type TabActivity is deprecated"? “TabActivity类型已被弃用”?

I am making the Tabs of app following tutorial book. 我正在按照教程书制作应用程序选项卡。

I've checked from the android developer.com website, but i have no ideas on the significance of the following message : This class is deprecated. 我已经从android developer.com网站上查了一下,但我对以下消息的重要性没有任何想法: This class is deprecated.

New applications should use Fragments instead of this class; 新应用程序应使用Fragments而不是此类; to continue to run on older devices, you can use the v4 support library which provides a version of the Fragment API that is compatible down to DONUT."* (http://developer.android.com/reference/android/app/TabActivity.html) 要继续在旧设备上运行,您可以使用v4支持库,该库提供与DONUT兼容的Fragment API版本。“*(http://developer.android.com/reference/android/app/TabActivity的.html)

  1. What is v4 support library? 什么是v4支持库?
  2. How to finish the tab functions? 如何完成标签功能?

You can still use a deprecated package. 您仍然可以使用已弃用的软件包。 It is however recommended to use Fragments, and thus the support package. 但是建议使用Fragments,从而使用支持包。 You can read more about it here . 你可以在这里阅读更多相关信息。 However, if you are a beginner at java and android development, I would recommend ignoring the deprecation for now and come back to this when you have completed the tutorial you are currently using if you find it educating. 但是,如果你是java和android开发的初学者,我建议暂时忽略弃用,如果你发现它正在教育,那么当你完成当前正在使用的教程时再回到这一点。

If you want to watch a nice example of tabbed navigation using Fragments, then create a new project in Eclipse using android 4.0 or later. 如果你想看一个使用Fragments的标签导航的好例子,那么使用android 4.0或更高版本在Eclipse中创建一个新项目。 Make sure your android-plugin is updated. 确保你的android-plugin已更新。 You will get the option to create a project with basic navigation already implemented. 您将获得创建已实施基本导航的项目的选项。

"Deprecated" means that the api developers don't recommend using it anymore, probably because its not a good model, or inefficient, etc. Fragments were introduced in Honeycomb and can be used to provide a similar functionality as tabs and is more in-line with android's current design philosophy. “弃用”意味着api开发人员不再推荐使用它,可能是因为它不是一个好的模型,或者效率低下等。在Honeycomb中引入了Fragments ,可以用来提供与标签类似的功能,并且更多 -符合android目前的设计理念。

Since Fragment was introduced in Android 3.0 Honeycomb , you might think you cannot use that for pre- Honeycomb devices. 由于Fragment是在Android 3.0 Honeycomb引入的,您可能认为不能将其用于预Honeycomb设备。 Enter Support Libraries . 输入Support Libraries They are libraries which you can include in your application which needs to run on pre- Honeycomb and still use this class. 它们是您可以包含在应用程序中的库,它们需要在Honeycomb之前运行并仍然使用此类。

So if you want to, you can finish the TabActivity as described in whatever tutorial you are following, it'll probably work on a few more upcoming android versions. 因此,如果您愿意,您可以按照您所遵循的任何教程中的描述完成TabActivity ,它可能适用于更多即将推出的Android版本。 But it is recommended that you start using Fragments . 但建议您开始使用Fragments

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM