requestFeature()mustbecalledbeforeaddingcontent解决方法
今天在做一个app引导界面的时候,想设置成全屏显示,一直报错aused by: android.util.AndroidRuntimeException:
requestFeature() must be called before adding content,百度了很多都不行后来实在没办法了,Google了一下,终于解决了,由于我用的是Google最新的开发工具,继承的是ActionBarActivity,改成继承Activity 完美解决!!
创新互联2013年至今,先为临漳等服务建站,临漳等地企业,进行企业商务咨询服务。为临漳企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
//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 ArrayListmPageViews; private MyPagerAdapter mPageAdapter; private ViewPager mFramePager; private ArrayList 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(); }
分享标题:requestFeature()mustbecalledbeforeaddingcontent解决方法
转载来源:http://pwwzsj.com/article/ggpoip.html