标签:android
今天在做一个app引导界面的时候,想设置成全屏显示,一直报错aused by: android.util.AndroidRuntimeException:
requestFeature() must be called before adding content,百度了很多都不行后来实在没办法了,Google了一下,终于解决了,由于我用的是Google最新的开发工具,继承的是ActionBarActivity,改成继承Activity 完美解决!!
//supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); //取消标题 requestWindowFeature(Window.FEATURE_NO_TITLE); //取消状态栏 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 写在 super.onCreate(savedInstanceState);this.setContentView(R.layout.activity_main); 之前
public class MainActivity extends Activity { private ViewPager mPager; private ArrayList<View> mPageViews; private MyPagerAdapter mPageAdapter; private ViewPager mFramePager; private ArrayList<View> mFramePageViews; private MyPagerAdapter mFramePageAdapter; @Override protected void onCreate(Bundle savedInstanceState) { //supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); //取消标题 requestWindowFeature(Window.FEATURE_NO_TITLE); //取消状态栏 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main); initViewPager(); }
本文出自 “阿乾-在路上” 博客,请务必保留此出处http://xiaocool.blog.51cto.com/1593956/1629170
requestFeature() must be called before adding content 解决方法
标签:android
原文地址:http://xiaocool.blog.51cto.com/1593956/1629170