今天在做一个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(); }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。