I've a full screen application covering the entire screen, top status bar included. Since a top / down swipe is enabled to show some options to the user, it happens that swiping from top to down, the status bar is showing (as when you want to see notifications and swipe top down). Is there a way to avoid this ?
相关问题
- 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
Use type TYPE_SYSTEM_ERROR for WindowManager.LayoutParams, to create hide impossible fullscreen view. Swipes for show status bar and navigation will be blocked.
And you should be show it after display power on (unlock screen) if needs. Add code:
There are a couple of options. Before the line
super.onCreate(savedInstanceState)
add the following:
This should completely get rid of the status bar. Basicaly the feature no title removes the top toolbar, and to ensure fullscreen size we are setting fullscreen flags for height and width.
As far as preventing from swiping at all, there is a trick that can be used. Basically place an invisible view at the top once you are in true fullscreen that prevents any swiping. For example,
This creates an invisible view over the status bar that will receive the touch events and block the events from reaching the status bar, therefore preventing it to be expanded.
Alternatively, and this works the best, is to override the windowFocusChanged method. Essentially you are NOT preventing the status bar from expanding, but YOU ARE preventing use. Because once expanded, it is closed. I say that this works best because with the invisible view methodology, you may want to consider the dimensions of the screen to really make it effective for all device. So there is more work.
First, declare permission in manifest
Then Override onWindowFocusChanged method,