如何支持Android 2.2以上版本的标签? [英] How to support tabs on Android 2.2+?

查看:186
本文介绍了如何支持Android 2.2以上版本的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为所有的Andr​​oid版本2.2及以上标签的支持。是否有实现这一目标而无需使用pcated类/方法的任何德$ P $的一种方式?

I'm trying to offer tab support for all Android versions 2.2 and above. Is there a way of achieving this without using any deprecated classes/methods?

推荐答案

问题是如下:
TabActivity是德precated因为它是从的ActivityGroup 这是德派生precated了。问题是,启动里面的标签Activitys,不破回调像 onActivityResume 。有一些黑客围绕解决这个,但他们都靠德precated的 LocalActivityManager 。所以,我看不出有什么用标签无任何德precated电话解决方案。由于Android 3.X谷歌发明 的片段为这种事情是支持与 SupportPackage 更低版本。你应该definetly尝试他们结合新的动作条的,如果你想避免去precated类/方法

The Problem is as following: TabActivity is deprecated because it derives from ActivityGroup which is deprecated, too. Problems are, to start Activitys inside Tabs and don't break callbacks like onActivityResume. There are some 'Hacks' around which solve this but they are ALL relying on the deprecated LocalActivityManager. So I see no solution of using Tabs without ANY deprecated calls. Since Android 3.X google invented Fragments for this kind of things which are supported on lower Versions with the SupportPackage. You should definetly try them in Combination with the new ActionBar if you want to avoid deprecated classes/methods

编辑:
链接到<一个href=\"http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html\"相对=nofollow> FragmentTabs 作进一步参考

这篇关于如何支持Android 2.2以上版本的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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