Question: I'm learning android development and I'm doing a minesweeper. So I use a tableLayout to display the board. But how can I do to adapt the width of the cells to fit the screen ?

Currently my cells are fixed so the grid expand beyond the side of the screen...

How can I take the entire screen width for my tableLayout ?

Thanks.

Answer: 
since you are creating your cells dynamically,
you can calculate the height and width of the screen using:

```
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();  
int height = display.getHeight();

```

and then set your cell size accordingly.
This is done through using simple properties found inside of your layout file xml file. Specifically you want to set the

```
android:layout_width="fill_parent"

```

This will tell the layout to consume the ENTIRE width of its parent.