0

How can I know programmatically if a device has a navigation bar and if it has it how can i get the size (width and height).

I tried this solution stackoverflow.com/a/29938139/1683141 and when I test a Sony Xperia Z on Genimotion, returns that not has a navigation bar but it has!

Please I need to fix this cases with navigation bar, because the app not looks good.

Thanks

Community
  • 1
  • 1
user3240604
  • 327
  • 1
  • 6
  • 21
  • instead of trying to use a hacky work around that may or may not work why dont you tell us what your UI looks like and how you want it to look – tyczj Jul 28 '15 at 18:43
  • i want to know that,because the nav bar can´t dissapear forever – user3240604 Jul 28 '15 at 19:23
  • The reason that it returns 0, is because you are running on an emulator. The emulator has 'emulated' physical buttons, whereas an actual, physical device will not. – Mdlc Apr 08 '16 at 15:08

1 Answers1

1

Try this answer to the question you linked. The difference between appUsableSize and realScreenSize is the space occupied by the navigation bar. (This works because, somewhat unexpectedly, the status bar counts toward appUsableSize.) If both sizes are the same, you have no navigation bar.

Community
  • 1
  • 1
user149408
  • 4,098
  • 1
  • 25
  • 46