 <p>Set LayoutParams as FILL_PARENT in both width and height</p> <pre><code> public void onClick(View view) { //getSupportActionBar().hide();if you need hidden actionbar also view.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); } </code></pre>