2

I'm working with the Kindle Fire HD 8.9", and unlike other Android tablets, its navigation bar (Back, Home, etc.) resides on the right edge of the device rather than the bottom edge. This is causing layout issues for myself since I need to calculate sizes as a percentage of the available screen width.

I've tried Display#getPoint(Point), as the Javadoc wording makes it sound like it will exclude system decor, but it does not for this device. I'm also aware of setting a OnLayoutChangeListener on my root view, but I need to know the available size prior to when this listener is triggered.

So is there a way to get the size of the navigation bar programmatically? I've calculated the size to be 90px, but I want to avoid hardcoding as it's risk-prone.

Jason Robinson
  • 31,005
  • 19
  • 77
  • 131
  • What version of Android does it use? Display.getWidth and getHeight definitely return without the decorations on v13 and above but display with the decorations on v12 and below. It caused a major bug when they changed it on me. IF that doesn't work, what about making the top level view be fill_parent width and height and using its dimensions as the size of the screen? – Gabe Sechan Feb 14 '13 at 18:55
  • @GabeSechan It's API level 15. Your second suggestion would work, but I was hoping there was a way to find the width of the nav bar without having to wait for my layout to draw. – Jason Robinson Feb 14 '13 at 22:28
  • I think the SampleSoftkeyConfig sample here might give you what you need https://developer.amazon.com/sdk/fire/samples.html – Offbeatmammal Feb 15 '13 at 02:34
  • @JasonRobinson Did you ever solve this? I'm facing a similar layout issue. – Nick Feb 10 '14 at 18:12
  • @Nick Unfortunately not. I ended up hard-coding it. – Jason Robinson Feb 10 '14 at 18:13

0 Answers0