在谷歌官网上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试试。
<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试试。
建议你先下点源码或者看看文档再说
建议你先下点源码或者看看文档再说单独用Fragment我知道,关键是你看我上面的代码,是继承的FragmentActivity,不是Fragment。这代码不是Google API上的么?