Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在学习使用片段来构建动态应用程序,但是片段管理器有问题。当我通过 getFragmentManager() 方法传递它时,会显示一个警告,因为它返回 android.app 的片段管理器,而不是来自支持库。你知道如何解决吗?
你应该使用getSupportFragmentManager()而不是getFragmentManager()
getSupportFragmentManager()
getFragmentManager()
此外,请确保您正在扩展FragmentActivity,而不仅仅是Activity.
FragmentActivity
Activity