// The Action bar is a window feature. The feature must be requested // before setting a content vIEw. normally this is set automatically // by your Activity's theme in your manifest. The provIDed system // theme theme.WithActionbar enables this for you. Use it as you would // use theme.NoTitlebar. You can add an Action bar to your own themes // by adding the element <item name="androID:windowActionbar">true</item> // to your style deFinition. getwindow().requestFeature(Window.FEATURE_ACTION_bar);
但是当我试图添加最后一行代码getwindow().requestFeature(Window.FEATURE_ACTION_bar);我的应用程序刚启动就死了.那真的是什么呢?
解决方法 秘密是呼叫的顺序.必须在填充任何内容之前调用请求功能.我按此顺序执行并且工作正常:getwindow().requestFeature(Window.FEATURE_ACTION_bar);super.onCreate(savedInstanceState);getSupportActionbar().hIDe();setContentVIEw(R.layout.your_activity_layout);总结
以上是内存溢出为你收集整理的android – 带动作栏的requestFeature全部内容,希望文章能够帮你解决android – 带动作栏的requestFeature所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)