
我找到了一个解决方案并在我的样式中插入以下内容:
<style name="NoActionbar" parent="@androID:style/theme.Holo.light"> <item name="androID:windowActionbar">false</item> <item name="androID:windowNoTitle">true</item> <item name="androID:windowFullscreen">true</item> <item name="androID:windowContentOverlay">@null</item> </style>@H_403_5@并在AndroIDManifest中将该行添加到我的活动中:
androID:theme="@style/NoActionbar"@H_403_5@最后我没有标题栏,没有内容覆盖,但Actionbar仍然存在.请指教.我使用androID:theme =“@ androID:style / theme.Holo.light”,我的targetSdkVersion是18.解决方法 XML中的小错误会导致非常奇怪的问题,
这些并不总是由构建过程准确报告.
当我可以在java中完成它时,我倾向于回避改变XML.
Java为您提供更多控制.
programmatically remove action bar----------------------------------from normal activitygetActionbar().hIDe();getActionbar().show();if your using support activitygetSupportActionbar().hIDe();getSupportActionbar().show();and from the Fragment you can do itgetActivity().getActionbar().hIDe();getActivity().getActionbar().show();remove Title bar----------------public class Activityname extends Activity { @OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // remove Title requestwindowFeature(Window.FEATURE_NO_Title); getwindow().setFlags(WindowManager.LayoutParams.FLAG_FulLSCREEN,WindowManager.LayoutParams.FLAG_FulLSCREEN); setContentVIEw(R.layout.main); }}Actionbar ContentOverlay------------------------1) Request for actionbar overlay programmatically by calling getwindow().requestFeature(Window.FEATURE_ACTION_bar_OVERLAY);// this 'requestFeature()' must be requested from your activity 'onCreate()' method// before calling for 'setContentVIEw(R.layout.my_layout)':2) set the actionbar color by calling setBackgroundDrawable() like so:getSupportActionbar().setBackgroundDrawable(new colorDrawable(color.parsecolor("#00212121")) ); 总结 以上是内存溢出为你收集整理的android – WindowActivityBar = false无法正常工作全部内容,希望文章能够帮你解决android – WindowActivityBar = false无法正常工作所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)