0

In my app, there is no need of the status and navigation bar.

I did find solutions to hide the status / navigation bar but you can still pull them back. I was thinking about doing two things. One would be to create a Thread that checks if the status bar is opening, so it can hide immediately. This just seems to be a very dodgy thing to me.

I spoke to a guy who was involved in a similar project years ago and he said they achieved that they didn't hide the status bar but it was completely empty and when you tried to pull it down it was about 1mm long and was completely useless.

I might would like to try to go this way.

Can you guys give me a few examples of how to: - get a rid of the battery icon - get a rid of the time - get a rid of the notifications ...etc

So basically make it to be completely empty?

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
d4Mn
  • 51
  • 7
  • 1
    I think this is what you basically need https://stackoverflow.com/questions/2868047/fullscreen-activity-in-android – Digvijaysinh Gohil Apr 13 '18 at 15:29
  • [Android fullscreen app - prevent access to status bar](https://stackoverflow.com/a/38533354/3290339) – Onik Apr 13 '18 at 19:29
  • @Digvijaysinh Gohil this corretcly hides the status bar but it is still able to be wiped down – d4Mn Apr 14 '18 at 12:55
  • What I am looking for is very-very similar what the system ui tuner can do, unfortunately I need to root the tablet to achieve the same probably – d4Mn Apr 14 '18 at 12:56

4 Answers4

0

So let me know if I understood it, You need the status bar gone inside your app right? Why not just use a fullscreen activity?

Do it programatically:

requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main);

Or specify a theme in the Android Manifest:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
Ratul Bin Tazul
  • 2,121
  • 1
  • 15
  • 23
  • If I understood it properly in fullscreen mode you can still wipe down the status bar, this must be prevented. The tablet will be used by people who cannot read or write and their focus must stay on the running application. – d4Mn Apr 14 '18 at 12:50
  • It's almost impossible. Check this question for further explanation https://stackoverflow.com/questions/7457730/preventing-status-bar-expansion – Ratul Bin Tazul Apr 15 '18 at 15:06
  • 1
    Thank you for your answer, if you follow some links from the page you linked me you see it can be achieved with the customViewGroup. Before the "customViewGroup" it was impossible without rooting the system. – d4Mn Apr 16 '18 at 14:51
0

It seems like you have implemented the IMMERSIVE_STICKY flag which allows the status bar to be called by top-down swipe on the top of the screen.

To disable status drop down, use this method. This is an overlay over status bar and consumed all input events. It prevents the status from expanding.

Android Manifest

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> 

customViewGroup implementation

WindowManager manager = ((WindowManager) getApplicationContext()
            .getSystemService(Context.WINDOW_SERVICE));

WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|

            // this is to enable the notification to recieve touch events
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |

            // Draws over status bar
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;

    localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    localLayoutParams.height = (int) (50 * getResources()
            .getDisplayMetrics().scaledDensity);
    localLayoutParams.format = PixelFormat.TRANSPARENT;

    customViewGroup view = new customViewGroup(this);

    manager.addView(view, localLayoutParams);
Abhi
  • 3,431
  • 1
  • 17
  • 35
  • Thank you for your answer, I will give it a go during the weekend. Is there also a solution to do the same with the navigation bar? – d4Mn Apr 14 '18 at 12:53
0

As I am working on creating a special purpose machine and I need the android device to do only 1 thing I ended up creating my own AOSP build with the following mod:

The status bar layout is here:

frameworks/base/packages/SystemUI/res/layout/status_bar.xml

Did change the height to 0dp.

Works perfectly fine, there is no status bar anymore. Thanks everyone who downvoted the question.

It is also possible to "empty" the status bar by making the icons visibility to GONE (AOSP custom build solution again)...

d4Mn
  • 51
  • 7
0

I think those few people who post above me might be a little confuse to read and understand. My is short and simple

If you want to hide your status bar and action bar here it i. I hope it helps :)

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

getSupportActionBar().hide();
iPR3DATOR
  • 11
  • 6