问题描述
对此我需要帮助.我意识到这件事很奇怪.为了禁用操作栏(标题),我需要在此代码中添加
i need help for this . I realize sth very strange about this. In order to disable the Action bar (Title) , i need to add in this code
requestWindowFeature(Window.FEATURE_NO_TITLE);
所以这仅适用于我从
extends AppCompatActivity
对此
extends Activity
因此,在更改了此内容之后,getFragmentManager出现了错误.
请查看屏幕截图.并且让我知道你们是否还有任何想法?THx
Please have a look at the screenshot. And let me know if u guys have any idea wads going on? THx
推荐答案
使用 getSupportFragmentManager()
代替 getFragmentManager()
. AppCompatActivity
是v4库,因此需要使用v4函数
Use getSupportFragmentManager()
instead of getFragmentManager()
.AppCompatActivity
is v4 library therefore required to use v4 functions
并在 Activity
中使用它而不是在 Activity
中将其更改为 FragmentActivity
.然后,您可以使用 getSupportFragmentManager()
And to use it in Activity
instead of Activity
change it to FragmentActivity
. Then you can use getSupportFragmentManager()
这篇关于getFragmentManager vs getSupportFragmentManager错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!