android.support.v4.app.FragmentTabHost添加后运行提示项目停止运行

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.administrator.myapplication.MainActivity">

<FrameLayout
    android:id="@+id/contentLayout"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    tools:ignore="InefficientWeight">

</FrameLayout>

<android.support.v4.app.FragmentTabHost

android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F6F6F6">
<FrameLayout
    android:id="@android:id/tabcontent"
    android:layout_width="0dp"
    android:layout_height="0dp"/>

</android.support.v4.app.FragmentTabHost>
</LinearLayout>
我刚刚开始接触安卓开发,在项目中添加android.support.v4.app.FragmentTabHost这个标签之后,测试运行项目则提示项目停止运行,删除android.support.v4.app.FragmentTabHost这个标签之后则能够正常运行项目,请问各位大神,问题出现在哪里?谢谢

阅读 3.6k
2 个回答

你的acitivity继承自FragmentActivity了吗?

错误日志是怎样的?在哪里报错?凭空想象不来你的问题所在。就现在的信息只能判定你的项目没有把v4依赖包加进来。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题