Android: Width of a grid of buttons screen does not change with different screen resolutions
<p>My app makes a grid of 16x16 buttons. These are all set to 30dp in width and height. That makes 480x480dp. When testing on a 800x480 screen the app displays fine. But when I set my emulator to 400x240, the app is really ugly and the grid of buttons gets wider than the screen. </p>

<p>To solve this problem, I set the width and height of buttons to a variable named "knopAfmeting". That variable looks like is set with this piece of code:</p>

<pre><code>    Display display = getWindowManager().getDefaultDisplay(); 
    int schermBreedte = display.getWidth();
    int knopAfmeting = schermBreedte/16;
</code></pre>

<p>And then the buttons are set like this:</p>

<pre><code>    Button button = new Button (this);
    button.setHeight(knopAfmeting);
    button.setWidth(knopAfmeting);
</code></pre>

<p>But when testing in a 400x240px screen, the app still displays the grid of buttons wrong. What am I doing wrong?</p>
