Note that there are some explanatory texts on larger screens.

plurals
  1. PODiscovering the true screen size (in pixels) for Android devices which have a Software Navigation Bar
    primarykey
    data
    text
    <p>I need to be able to know the exact size of the screen excluding the Software Navigation Bar before hand. I'm using the andengine to create a game.<br> We wanted to fully support the new Nexus line (4, 7 and 10)</p> <p>According to <a href="http://developer.android.com/design/style/metrics-grids.html" rel="nofollow noreferrer">this page</a>, which many have pointed out, the size of the Software Navigation Bar should be 48dp.<br> Then using the information on <a href="https://android.stackexchange.com/questions/24922/why-can-the-nexus-7-display-so-much-more-content-on-screen-than-the-galaxy-nexus">this</a> excellent stackexchange post I gathered the formula for calculating the size of the Software Navigation Bar should be: <code>px = dp * (ppi / 160)</code></p> <p>According to <a href="http://www.google.com/nexus/7/specs/" rel="nofollow noreferrer">the official site</a> the Nexus 7 has a 216 ppi screen.<br> The Software Navigation Bar should then be: <code>48 * (216 / 160) = 64.8 ≈ 64px</code><br> We have a Nexus 7 tablet and the Software Navigation Bar is 75px.</p> <p>This means that either the ppi value is <code>(75 * 160) / 48 = 250</code><br> or<br> the dp size is in fact <code>(75 / 216) * 160 = 55.555... ≈ 55dp</code></p> <p>So which is it?</p> <p>Furthermore the 4.2 Android SDK comes with some premade AVDs. Included among them is the Nexus 7. There the size of the Software Navigation Bar is reported to be 64px...</p> <p>I'm not asking for the sizes of these devices, I can just google (or search stackexchange) for those numbers. Is it not possible to be sure of a device's screen size without purchasing that device?</p> <p><strong>[edit]</strong><br> I thought I should add that I'm getting the screen size with the following method: </p> <pre><code>WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); DisplayMetrics screenSize = new DisplayMetrics(); display.getMetrics(screenSize); CAMERA_WIDTH = screenSize.widthPixels; CAMERA_HEIGHT = screenSize.heightPixels; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload