Android FRAGMENT 'requestFeature must be called'

元气小坏坏 提交于 2019-12-10 20:53:11

问题


I am having trouble trying to use 'requestFeature' in my FRAGMENT. My code is below, I am trying to set the actionbar as an overlay.

    @Override
public void onCreate(Bundle savedInstanceState) {
    getActivity().requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);

I do not want to use a theme because I don't want the whole app to be effected, only this fragment in particular.


回答1:


You have to call requestWindowFeature() before the setContentView() in the Activity's onCreate() method. This Activity is the one that your fragment is a part of.



来源:https://stackoverflow.com/questions/20307183/android-fragment-requestfeature-must-be-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!