问题
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