Artikel mit ‘Margin’ getagged

TableLayout with borders / margins

Mittwoch, 14. Juli 2010

Hey everybody,

in my latest Android game i had the problem that i had a TableLayout with 4×4 icons (cards) in it. There should be a border between them. But neither setting “android:layout_margin” or anything else i tried did work :( So i had the idea of surrounding each of my table cells content (the icon) with a LinearLayout that only containt the content (the icon) and set a padding (left, right, top, bottom, 2px) on that LinearLayout. And: it works perfectly :D Hope that helps many developers that also have problems with TableLayout and borders / margins.

See the app screenshot for a view of what i wanted to do:

Gr33tz Goddchen

Share