因为需要测试有关Fragment的一些东西,静态加载Fragment一直不成功,如下所示
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <fragment android:name="com.zy.staticfragment.Fragment1" android:layout_width="match_parent" android:layout_height="fill_parent" /> </LinearLayout>错误一直提示找不到Fragment类,但是我反复检查了,没有错呀:
最后我直接在布局中为fragment加了一个id,妈的,立即通过,我也是醉了