android - Why are these buttons mis-aligned in a TableLayout? -


i'm using table layout arrange buttons. long use same font labels aligned in each row.

for buttons i'd use icons custom ttf font. when use such icon, button placed higher, so:

slight offset

(this image scaled make the problem more evident.)

i took measurements - buttons appear of same height, regardless of used font.

why buttons not aligned properly? have suggestion them aligned?

thanks.

following commonsware's advice (thanks quick replies!), 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. try base alignment comment next.

add following attribute tablerow:

android:baselinealigned="false" 

by default, button labels' base lines vertically aligned causes offset experience.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -