在谷歌官网上Fragmen的例子xml文档是这样写的:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
    <fragment class="com.example.android.apis.app.FragmentLayout$TitlesFragment"
            android:id="@+id/titles"
            android:layout_width="match_parent" android:layout_height="match_parent" />
</FrameLayout>
你在你的xml文件中也添加上class试试。

解决方案 »

  1.   

    不知道他有没有建好Fragment,要不然怎么会这样写
      

  2.   

    Fragment可以看做是子Activity,你确定你建了Fragment类,继承了Fragment,配置了xml文件?
    建议你先下点源码或者看看文档再说
      

  3.   

    class没有写 没有对应好相应的fragment
      

  4.   

    LZ看下android4.0.3 ics下的browser源码吧,浏览器的历史收藏夹界面就是用这个做的
      

  5.   

    Fragment可以看做是子Activity,你确定你建了Fragment类,继承了Fragment,配置了xml文件?
    建议你先下点源码或者看看文档再说单独用Fragment我知道,关键是你看我上面的代码,是继承的FragmentActivity,不是Fragment。这代码不是Google API上的么?