Different android mobile phone has different behaviors of Virtual Navigation Bar in the bottom of the interface. For example Huawei has it. For other mobile phones, they don't have Virtual Navigation Bar. So how can I detect if there is Virtual Navigation Bar in different Android Mobile Phone?
Asked
Active
Viewed 708 times
1
-
Possible duplicate of [Check if Android device has software or hardware navigation buttons](http://stackoverflow.com/questions/28406506/check-if-android-device-has-software-or-hardware-navigation-buttons) – Lovis Nov 25 '16 at 08:54
1 Answers
0
To find if soft navigation is enabled determine the size of the window provided and to set the layout accordingly. There is a very powerful tool called decorView
that sets the window initially so as to directly implement methods under it. It can be written like this:
val decorView = window.decorView
decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
Write methods under it to put them inside the frame.
Methods you can use like this:
val decorView = window.decorView
decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
mBottomAppBar = findViewById(R.id.bar)
mBottomAppBar?.setOnMenuItemClickListener{
when(it.itemId){
R.id.itemConfig->showConfigBottomSheetDialogFragment()
Found this while trying a ton of methods and tricks and this one is the only one working. Hope it helps.

solbs
- 940
- 3
- 15
- 29

Sachin Barpanda
- 21
- 4