views:

40

answers:

2

Hey everyone. I'm not big into UI programming so this may be an easy thing I overlooked. I am trying have a screen that shows 8 TextView in a 2 column x 4 row table. And, of course, I want the TextViews, that might have different lengths, to be centered. I tried this in a table layout, for obvious reasons but I feel like this is not the way to do it because it doesn't have much control where I put everything once it is in a row. Should I be using a different combinations of layouts or is there something I overlooked.

I can post my xml file if you really need but this is really more of a concept question than a specific one.

Thanks, Jake

+1  A: 

Can you explain why a table layout didn't work in more detail? If you're just trying to center the contents of the cells, you can set the android:gravity attribute in the table layout to "center"

EDIT: You can set the spacing between items using the android:padding attribute (Documentation). There are a number of other attributes in that link you can use to modify the way your table is laid out, as well as table-specific attributes at this link.

QRohlf
I tried that and it didn't work, are there other attributes I have to to turn off in order for it to work?
Jake Schwartz
Ok, that worked for some reason now, how about putting more space between my columns?
Jake Schwartz
I've updated my answer with more detailed info and links to documentation you can use to further customize your views.
QRohlf
A: 

Check out apps-for-android's GridLayout. You may have to modify it a bit to get it to do exactly what you want, however, it's probably a good starting point.

Qberticus