知识点
xml文件
java 基础智商
抽象方法不需要方法体
protected abstract Fragment createFragment(); //correct protected abstract Fragment createFragment(){ ; //error!!!!
使用通用activity 托管 fragment
通用到布局定义文件activity_fragment.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
解决屏幕旋转 重构Activity的问题
可在加上 Fragment
里加上这行代码
setRetainInstance(true);
但这并不能解决所有的可能情形
不显示标题栏
加上这行代码
requestWindowFeature(Window.FEATURE_NO_TITLE);
注意是在 Fragment 所托管的 Activity 里面加