您好,登錄后才能下訂單哦!
今天在做一個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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。