0

I am trying to hide the status and the navigation bar and expand the activity to edges of the screen. I managed to hide them and expand the activity to status bar but not to the navbar, why? How can I hide the navbar completely?

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    View decorView = getWindow().getDecorView();
    int uiOptions;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
        uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                | View.SYSTEM_UI_FLAG_LOW_PROFILE;
    } else {
        uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LOW_PROFILE;
    }
    decorView.setSystemUiVisibility(uiOptions);

    setContentView(R.layout.activity_snake);

    //code

}

As you can see in picture with this code i have this border and i want the right side to touch to screen edge as the other sides

    X = getResources().getDisplayMetrics().widthPixels;
    Y = getResources().getDisplayMetrics().heightPixels;

    pts[0] = 0;
    pts[1] = 0;
    pts[2] = X;
    pts[3] = 0;

    pts[4] = 0;
    pts[5] = 0;
    pts[6] = 0;
    pts[7] = Y;

    pts[8] = X;
    pts[9] = 0;
    pts[10] = X;
    pts[11] = Y;

    pts[12] = 0;
    pts[13] = Y;
    pts[14] = X;
    pts[15] = Y;

    canvas.drawLines(pts, paint);

enter image description here

giannisj5
  • 119
  • 1
  • 11
  • 1
    Possible duplicate of [Fullscreen Activity in Android?](http://stackoverflow.com/questions/2868047/fullscreen-activity-in-android) – px06 Sep 09 '16 at 08:38
  • I am asking for the navbar as you see in picture in the right not the status bar – giannisj5 Sep 09 '16 at 14:04

0 Answers0