Android: Hide a LinearLayout onKeyDown
<p>I have a LinearLayout which holds a couple of buttons. To give the user more (drawing)space on the screen i want to hide this LinearLayout on Menu press:</p>

<pre><code>if (keyCode == KeyEvent.KEYCODE_MENU) {

                if (showButtons) {
                    showButtons = false;
                    LinearLayout lay = (LinearLayout) this.findViewById(R.id.buttonLayout);
                    laySize = lay.getHeight();

                    go2trimsecond();
                } else {
                    showButtons = true;
                    go2trimsecond();
                }
</code></pre>

<p>I thought i just save the height in if(showButtons), change the maxHeight of the layout to 0 and change it back on if(!showButtons), but unfortunatly i was thinking wrong, since there is no setMaxHeight.
Any idea how i should do this ?</p>
