当TabActivity处于弃用状态时,我该怎么办?

时间:2021-07-03 15:04:21

I tried make a project using tab activity.But the problem is when i declare the tab activity its not working.When i put my mouse on it it shows this documents

我尝试使用tab活动创建一个项目。但问题是当我声明tab活动它不工作时。当我把鼠标放在它上面它显示这个文件

This class is deprecated. New applications should use Fragments instead of this class; 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..... bla.....bla....bla.

不推荐使用此类。新应用程序应使用Fragments而不是此类;要继续在旧设备上运行,您可以使用v4支持库,它提供了与DONUT兼容的Fragment API版本..... bla ..... bla .... bla。

I thought my padding was not right,so i fix the xml.But it still the same.This my xml for Tab.

我以为我的填充不对,所以我修复了xml.But它仍然是相同的。这是我的xml for Tab。

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>

How can i solve the problem?

我该如何解决这个问题?

2 个解决方案

#1


4  

In the world of software development, "deprecated" refers to functions or elements that are in the process of being replaced by newer ones, So instead of TabActivity you can go for FragmentTabs.

在软件开发领域,“不赞成”是指正在被更新的功能或元素替换的功能或元素。因此,您可以选择FragmentTabs代替TabActivity。

#2


2  

I Think you are implementing TabGroupActivity Implementation to your application, which setCOntent to tab to an activityGroup, ActivityGroup has been deprecated from the Android Api, So as per suggestion you should use Fragments instead of TabGroup. See examples:

我认为您正在为您的应用程序实现TabGroupActivity Implementation,其中setCOntent选项卡为activityGroup,ActivityGroup已从Android Api弃用,因此根据建议您应使用Fragments而不是TabGroup。见例子:

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

#1


4  

In the world of software development, "deprecated" refers to functions or elements that are in the process of being replaced by newer ones, So instead of TabActivity you can go for FragmentTabs.

在软件开发领域,“不赞成”是指正在被更新的功能或元素替换的功能或元素。因此,您可以选择FragmentTabs代替TabActivity。

#2


2  

I Think you are implementing TabGroupActivity Implementation to your application, which setCOntent to tab to an activityGroup, ActivityGroup has been deprecated from the Android Api, So as per suggestion you should use Fragments instead of TabGroup. See examples:

我认为您正在为您的应用程序实现TabGroupActivity Implementation,其中setCOntent选项卡为activityGroup,ActivityGroup已从Android Api弃用,因此根据建议您应使用Fragments而不是TabGroup。见例子:

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/