改为fragmentManager = getFragmentManager();试试
getFragmentManager()是获取Android.app.FragmentManager的,getSupportFragmentManager()是获取 android.support.v4.app.FragmentManager的,你看看你是属于哪一种fragmentmanager
getFragmentManager()是获取Android.app.FragmentManager的,getSupportFragmentManager()是获取 android.support.v4.app.FragmentManager的,你看看你是属于哪一种fragmentmanager
谢谢,getFragmentManager() 和 getSupportFragmentManager()两种都试了,还是一样的结果
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.timetracker.TimeTrackerActivity"
tools:ignore="MergeRootFrame" />frame_time_tracker.xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_tracker"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
tools:context="com.example.timetracker.TimeTrackerActivity$TimeTrackerFragment" ></LinearLayout>