Android - How to unhide soft buttons after programatically hiding them?
Asked Answered
I

2

5

Some android phones have soft buttons (back, home, menu). I manage to hide them using setSystemUiVisibility as described here.

However, how to make the softbuttons visible pragmatically?

Ileac answered 17/12, 2018 at 9:15 Comment(0)
G
6

You can use setSystemUiVisibility()

  • Request that the visibility of the status bar or other screen/window decorations be changed.

SAMPLE CODE

public class MainActivity extends AppCompatActivity {

    TextView tvTextView;

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

        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

        setContentView(R.layout.activity_main);

        tvTextView=findViewById(R.id.tvTextView);
        tvTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getWindow().getDecorView().setSystemUiVisibility(View.VISIBLE);
            }
        });

    }
Grenier answered 17/12, 2018 at 9:23 Comment(0)
I
1

Setting View.SYSTEM_UI_FLAG_VISIBLE worked for me.

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
Ileac answered 17/12, 2018 at 9:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.