How do I make an activity full screen? I mean without the notification bar. Any ideas?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
TIP: Using getWindow().setLayout() can screw up your full screen display! Note the documentation for this method says:
http://developer.android.com/reference/android/view/Window.html#setLayout%28int,%20int%29
For my purposes, I found that I had to use setLayout with absolute parameters to resize my full screen window correctly. Most of the time, this worked fine. It was called by an onConfigurationChanged() event. There was a hiccup, however. If the user exited the app, changed the orientation, and reentered, it would lead to firing off my code which included setLayout(). During this re-entry time window, my status bar (which was hidden by the manifest) would be made to re-appear, but at any other time setLayout() would not cause this! The solution was to add an additional setLayout() call after the one with the hard values like so:
The window then correctly re-sized, and the status bar did not re-appear regardless of the event which triggered this.
You can do it programatically:
Or you can do it via your
AndroidManifest.xml
file:Edit:
If you are using AppCompatActivity then you need to set theme as below
If you don't want to use the theme
@android:style/Theme.NoTitleBar.Fullscreen
because you are already using a theme of you own, you can useandroid:windowFullscreen
.In AndroidManifest.xml:
In styles.xml:
For those using AppCompact... style.xml
Then put the name in your manifest...
Just paste this code into
onCreate()
methodBe careful with
If you are using any method to set the action bar as the follow:
It will cause a null pointer exception.