如何在Android中隐藏状态栏 [英] How to hide status bar in Android

查看:37
本文介绍了如何在Android中隐藏状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提到了这个链接.如果用户点击 EditText(例如 To: ),此时键盘将弹出,同时用户可以滚动查看所有剩余的视图(例如:撰写、主题、发送按钮)那个屏幕.同样,在我的应用程序中,我有一个活动,因为我有一些小部件或视图.假设如果用户单击我的 Activity 中的 Edittext,则键盘会弹出,我可以滚动查看剩余的视图.但是如果我在清单中给这个属性 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 我无法滚动查看剩余的视图但是如果给属性 android:theme="@android:style/Theme.NoTitleBar" 在清单中像这样我可以滚动查看剩余的视图,但该屏幕中有状态栏,在这里我想要全屏,即使键盘弹出我可以滚动查看剩余的视图..?我必须为此做出哪些改变..?

I referred this link. In that if the user clicks on EditText(for ex To: ) at that time keyboard will be popped out and at the same time the user can be able to scroll to see all remaining views(ex: compose,subject, send button) in that screen. Similarly in my app I have one activity in that I am having some widgets or views. Suppose if the user clicks on Edittext which is in my Activity then keyboard is popping out and i can be able to scroll to see remaining views. But if i give this attribute android:theme="@android:style/Theme.NoTitleBar.Fullscreen" in manifest i was unable to scroll to see remaining views but if give attribute android:theme="@android:style/Theme.NoTitleBar" like this in manifest I can be able to scroll to see remaining view but there is status bar in that screen, here I want full screen and even if the keyboard is popped out I can scroll to see remaining views..? what changes I have to made for this..?

推荐答案

在你的活动中写下这个

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

在此处检查文档:https://developer.android.com/training/system-ui/status.html

您的应用将全屏显示.没有状态栏,没有标题栏.:)

and your app will go fullscreen. no status bar, no title bar. :)

这篇关于如何在Android中隐藏状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆