Detect soft navigation bar availability in android device progmatically?

后端 未结 7 1338
礼貌的吻别
礼貌的吻别 2020-12-02 18:50

I am trying to determine soft navigation bar through the android program. I didn\'t find straight way to determine. Is there anyway to find the navigation bar availability.

相关标签:
7条回答
  • 2020-12-02 19:25

    Right answer and other are not actual now.
    There are exist some options like 'Full Screen Display -> Full Screen Gestures' where navigation bar is hidden but all this methods returns that he is present.

    I suggest you to use this way to check size of system views. In onCreate method:

    ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), 
      (v, insets) -> { 
          int navigationBarHeight = insets.getSystemWindowInsetBottom();
          return insets;
      });
    
    0 讨论(0)
提交回复
热议问题