如何在Android中隐藏状态栏

我提到了这个链接。在这种情况下,如果用户单击EditText(对于ex To:),将弹出键盘,同时用户可以滚动查看所有剩余的视图(例如:compose,subject,send按钮)。该屏幕。同样,在我的应用程序中,我有一个活动,就是我有一些小部件或视图。假设如果用户单击“我的活动”中的Edittext,则弹出键盘,并且我可以滚动查看其余视图。但是,如果我android:theme="@android:style/Theme.NoTitleBar.Fullscreen"在清单中指定此属性,则无法滚动以查看其余视图,但是如果Give属性android:theme="@android:style/Theme.NoTitleBar"这样,我可以在清单中滚动查看剩余的视图,但是该屏幕上有状态栏,这里我要全屏显示,即使弹出键盘,也可以滚动查看剩余的视图..?为此我需要做哪些更改?

慕雪6442864
浏览 592回答 3
3回答

倚天杖

&nbsp;if (Build.VERSION.SDK_INT < 16) {&nbsp; &nbsp;getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);&nbsp;} else {&nbsp; &nbsp; &nbsp;View decorView = getWindow().getDecorView();&nbsp; &nbsp; &nbsp; int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;&nbsp; &nbsp; &nbsp; decorView.setSystemUiVisibility(uiOptions);&nbsp; &nbsp; &nbsp; ActionBar actionBar = getActionBar();&nbsp; &nbsp; &nbsp; actionBar.hide();&nbsp;}

千巷猫影

将此添加到您的活动类@Overrideprotected void onCreate(Bundle savedInstanceState) {&nbsp; &nbsp; super.onCreate(savedInstanceState);&nbsp; &nbsp; requestWindowFeature(Window.FEATURE_NO_TITLE);&nbsp; &nbsp; this.getWindow().setFlags(&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WindowManager.LayoutParams.FLAG_FULLSCREEN,&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WindowManager.LayoutParams.FLAG_FULLSCREEN);&nbsp; &nbsp; setContentView(R.layout.activity_main);&nbsp; &nbsp; // some your code}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Android