Border Lines for cells in GridLayout, TableLayout, or GridView?

Is there an attirbute that I missed in TableLayout or GridLayout that will give me border lines via the xml?

No.

If no, then will the GridView give me the lines I want?

No.

Will I be able to add all the perviously mentioned items I want to the GridView?

Yes, though how well something like a Spinner will work, I can't say.

The simplest way, off the top of my head, to give you the lines you seek is to have each cell of the TableLayout or GridLayout be some container containing the widget(s) for that cell, where you give the container a background that is your line. A ShapeDrawable could be defined in XML for that background, which will be nicely resizeable based upon the actual requirements of the cell.


I was actually able to achieve the desired look by setting the android:background="#000000" within the GridLayout view and then in the child items I set the android:background="#8CDD81" (just some green color) and combined with android:layout_margin="2dp" I was able to get the "grid" lines that I wanted. Thanks to CommonsWare though for getting me thinking in a new direction that turned into a solution.

EDIT: This does not work quite as anticipated. You need the android:layout_alignLeft/Right which are only available via RelativeLayout in order to get just the right width on the child items. Haven't tested this yet using this idea, child items within RelativeLayout within GridLayout.