Skip to content

Kindle Fire Screen Size and the 20px Softbar

The [amazon_link id=”B0051VVOB2″ target=”_blank” locale=”US” container=”” container_class=”” ]Kindle Fire[/amazon_link] has a 7″ display with a resolution of 1024×600 pixels. That is also what the window manager returns.

DisplayMetrics metrics = new DisplayMetrics();

The problem is that the [amazon_link id=”B0051VVOB2″ target=”_blank” locale=”US” container=”” container_class=”” ]Kindle Fire[/amazon_link] does not have any hardware keys so the main function keys are realized in software. That is why the Fire has a 20px soft key bar which grows to 40px when expanded. Backgrounds that are optimized for 1024×600 are automatically scaled to the new size (either 1004px or 580px). But on some occasions it is required to know what the actual screen size is. I didn’t find any method that returned the effective screen size and since I didn’t want to make 2 different apks I tried another approach.

At the beginning of my App I have a splash screen which shows my logo. The splash screen is just a basic Imageview which fills the whole screen. I subclassed the ImageView class and overrode the onLayout method which is called from Layout every time the size changes. On a resize event onLayout returns the width and height of the ImageView and that is exactly what happens when the soft key bar is applied to the screen.

It’s an easy and effective way to determine the real screen size.

Leave a Reply

Your email address will not be published.