public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button bt; Button bt2; Button bt3; Button bt4; bt=(Button)findViewById(R.id.button1); bt2=(Button)findViewById(R.id.button2); bt3=(Button)findViewById(R.id.button3); bt4=(Button)findViewById(R.id.button4); Display display = this.getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height=display.getHeight(); bt.setHeight((int) ((height)*0.2)); bt2.setHeight((int) ((height)*0.3)); bt3.setHeight((int) ((height)*0.3)); bt4.setHeight((int) ((height)*0.2)); }