Tabhost教程坏了吗? [英] Tabhost tutorial broken?

查看:140
本文介绍了Tabhost教程坏了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/4963773/anyone-know-what-this-error-mean-for-android-tabs\">Anyone知道这是什么错误为Android标签是什么意思?

我一直在尝试做SDK中TabHost教程,但出于某种原因,似乎是打破。第4步我复制并粘贴XML code,我得到的美元的膨胀正确p $ pvents是一个错误。错误的是:

I have been trying to do the TabHost tutorial in the SDK but for some reason, is appears to break. On Step 4 I copy and paste the xml code, I get an error that prevents it from inflating properly. the error is:

 Error in an XML file: aborting build.

这是在XML文件中的图形布局。

This is in the graphical layout of the xml file.

Error during post inflation process:
TabHost requires a TabWidget with id "android:id/tabs",
View found with id "tabs" is 'com.android.layoutlib.bridge.MockView'

中的XML文件本身具有这样的吧。

The xml file Itself has this in it.

    <?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"
        android:padding="5dp">
        <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"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>

我是不是做错了什么?

Am I doing something wrong?

推荐答案

请参阅第5步,你的活动必须扩展TabActivity,不活动

See step 5 , your Activity must extend TabActivity, not Activity

现在开放HelloTabWidget.java并使其扩展TabActivity:

Now open HelloTabWidget.java and make it extend TabActivity:

这篇关于Tabhost教程坏了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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