You can't do it in XML but if you want to go with the programmatically way you can try with something like this, i took the idea from here
//themedContext is an Activity or a Context which has a Theme attached,
//you can't use Application context for this
final TypedArray array = themedContext.getTheme().obtainStyledAttributes(
new int[] { android.R.attr.actionBarSize });
int actionBarSize = (int) array.getDimensionPixelSize(0, -1);
array.recycle();
Then to apply this to the Toolbar you could do:
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) myToolbar.getLayoutParams();
//half the height of toolbar prior to set its value
layoutParams.height = (int)(actionBarSize / 2);
myToolbar.setLayoutParams(layoutParams);
setSupportActionBar(myToolbar);
PS: don't forget that this attribute value changes when the device is rotated, so you should set this custom value every time the device changes from portrait to landscape and viceversa.