How to set border of GridView.
Such as Divider and DividerHeight of ListView.
Or how to display the border.
Here are some examples of borders in a GridView.

You can see where I defined the Red and Blue borders in my XML.
This is my main.xml Layout:
The thickness of the Red border is controlled GridView's layout_margin attribute and the Blue borders are controlled by horizontalSpacing and verticalSpacing.
To make the black cell backgrounds I used this layout and saved it as list_item.xml:
My Activity:
public class Example extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[] array = new String[] {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"};
List list = new ArrayList(Arrays.asList(array));
GridView grid = (GridView) findViewById(R.id.gridview);
grid.setAdapter(new ArrayAdapter(this, R.layout.list_item, list));
}
}