问题
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