Skip to content

Kindle Fire Screen Size and the 20px Softbar

The Kindle Fire has a 7″ display with a resolution of 1024×600 pixels. That is also what the window manager returns.

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);

The problem is that the Kindle Fire 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.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*