Android的片段“requestFeature必须调用” [英] Android FRAGMENT 'requestFeature must be called'
本文介绍了Android的片段“requestFeature必须调用”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有麻烦试图用'requestFeature在我的片段。我的code是下面,我想设置动作条为覆盖。
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.
推荐答案
您必须调用 requestWindowFeature()
在的setContentView()
在活动的的onCreate()
方法。此活动是那个你的片段中的一部分。
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.
这篇关于Android的片段“requestFeature必须调用”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文