机器人TabHost德precated机器人、TabHost、precated

2023-09-05 11:22:09 作者:格式化过去

我创建的应用程序,这将支持的Andr​​oid 2.2 到Android 4.1 。该 TabHost pcated在Android版本3.2代$ P $ 。但在所有的版本支持创建的应用程序。但我想创建标签栏应用程序,它看起来像在Android的一个标签栏 4.1 在运行应用程序的安卓4.2 ,如果我运行下面的应用程序的Andr​​oid 3.2版本设备,它必须看起来像该设备的标签栏。我怎样才能做到这一点?

I am creating application which will support Android 2.2 to Android 4.1. The TabHost is deprecated in Android version 3.2. But the created application supported in all the versions. But I want to create the Tab bar application which will look like a tab bar in Android 4.1 while running the application in Android 4.2, If I am running the application in below android 3.2 version device, it must look like the tab bar in that device. How can I do this.?

推荐答案

有很多点,你的问题,

TabHost 不德precated 的呢。最近谷歌德precated TabActivity 的ActivityGroup 。 即使德precated,它并不意味着它不能使用。 如果X是pcated德$ P $,它只意味着名为Y向更好的选择是存在的。 TabHost is not deprecated yet. Recently Google deprecated TabActivity and ActivityGroup. Even if it deprecated, it doesn't mean it can't be used. If X is deprecated, it only means a better alternative named Y is there.

现在回答你的问题,你有一个以上的选项

Now to answer your question, You have more than one options

您可以使用ActionBarSherlock其他答案建议。 您可以使用 TabHost 与片段,见我的回答here为一个 很好的例子。要使用片段在pre 3.0的API,你需要使用 谷歌的支持库。 You can use ActionBarSherlock as other answers suggests. You can use TabHost with fragments, See my answer here for a good example. To use Fragment in pre 3.0 API's you need to use Google's support library.