How To Hide Notification Bar, But Allow To Be Dragged From Top?
Solution 1:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.NAME_OF_YOUR_ACTIVITY);
getSupportActionBar().hide();
Put this code in your java activity and replace NAME_OF_YOUR_ACTIVITY
, than you have a fullscreen activity.
Solution 2:
There is no as such SDK support for this, but you may be able to do it with a bit of workaround coding.
You can use the WindowManager to inject an opaque floating View right at the top of the screen, which matches up with the rest of your layout and looks like a part of it.
Make sure your injected View is set to disregard touch events, and pass them down to whatever is below it. This should allow users to drag down the notification bar without actually keeping it visible on the screen. Well, it is still visible, just covered by your floating View.
Keep in mind that this will require your Activity theme to not be fullscreeen.
Solution 3:
Yes, It's possible just put the below code in your activity.
@OverridepublicvoidonWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
Viewview= getWindow().getDecorView();
if (hasFocus) {
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
);
}
}
In one of My Custom camera app i have used this which shows the full screen camera view witout notification bar and when you drag from top it will show you. Happy Coding... :)
Post a Comment for "How To Hide Notification Bar, But Allow To Be Dragged From Top?"