Find placement of Android Navigation Bar without Insets (inside Service)

依然范特西╮ 提交于 2021-01-29 06:25:01

问题


How to find the location of the Navigation Bar under certain rotations, in API 23, without using Insets (I run in a Service - see How to find dimensions for status bar, navigation bar and screen in Android AccessibilityService for more).

  • When Rotation is 0, Screen is Portrait, Status (if any) is at top of screen, Navigation (if any) at bottom.
  • When Rotation is 90, Screen is Landscape, Status is at top of screen, Navigation at right. (NB top/right are rotated)
  • When Rotation is 180, Screen is Landscape, Status is at top of screen, Navigation at left or right.
  • When Rotation is 270, Screen is Landscape, Status is at top of screen, Navigation at left.

The problem is 180 - the location of the Navigation Bar seems to depend on whether the last rotation was 90 or 270, no idea what happens if it was 0!

So I need to find out what side the Navigation Bar is on (I know if it is shown, and what size it is), and I can't use Insets (unless someone can answer the linked question and tell me how).

来源:https://stackoverflow.com/questions/65813343/find-placement-of-android-navigation-bar-without-insets-inside-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!