Alexander SKyzZz
Alexander SKyzZz

Reputation: 109

Android Navigator Bar full hide

public class StartActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                      | View.SYSTEM_UI_FLAG_FULLSCREEN
                      | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        decorView.setSystemUiVisibility(uiOptions);
        Button exitButton = (Button) findViewById(R.id.exitButton);
        exitButton.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                finish();
            }
        });
    }
}

I wrote this code , but when you click on editText the keyboard appears and navigator bar how to disable the appearance of this. Second question, when you press any button, I want the keyboard was closed by itself, if it is in the open state. Thank you.

The first screenshot shows how it should look like the app. The second screenshot shows, the appearance of unnecessary elements. When you click on the LOGIN button, the keyboard closes itself, or by clicking in any other place.

1.https://i.sstatic.net/0RNk6.png 2.https://i.sstatic.net/deMPd.png

Upvotes: 1

Views: 81

Answers (1)

JohanShogun
JohanShogun

Reputation: 2976

Remove your soft keyboard with:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);

Upvotes: 1

Related Questions