I'm using a table layout to arrange some buttons. As long as I use the same font for all the labels they are properly aligned in each row.
For some buttons I'd like to use icons from a custom ttf font. When I use such an icon, the button is placed slightly higher, like so:
(This image is scaled up to make the the problem more evident.)
I took measurements - the buttons appear to be of same height, regardless of the used font.
Why are the buttons not aligned properly? Does anyone have a suggestion to get them aligned?
Following CommonsWare's advice (thanks for the quick replies!), I tried this:
final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER_VERTICAL; row.setLayoutParams(layoutParams);
This did not work. Will try the base alignment comment next.