Question

We have an idea for a game running under Android and I've been playing around with the views a bit but cannot come up with something adequate.

The idea of the game is a fixed size matrix, and each cell in that matrix can hold a tile similar to Scrabble tiles.

By that I mean there's a letter on the tile and a score. The letter takes up most of the tile and the score is a little bit of text in the corner (no critiques on my graphical skills, this isn't the final product):

+---------+     +---------+
|   #     |     | ####    |
|  # #    |     | #   #   |
| #   #   |     | ####    |
| #####   |     | #   #   |
| #   #   |     | ####    |
|       17|     |       22|
+---------+     +---------+

Unlike Scrabble, the score of a tile is not related to its letter value so we need to be able to populate tiles with an arbitrary letter and score.

I've been using textviews and trying to turn them into a grid with borders around each cell (with a background image) but I can't seem to get views within views working, which I believe I need to ensure the border surrounds both textviews.

I've tried to use a table with each cell also a table, containing the letter and score. But I can't get a satisfactory result.

The number of letter/score combos will be quite high so I'm loathe to create images for each possible tile.

Has anyone else come across a similar problem, and what's the best way to solve it?

Was it helpful?

Solution

You will be quickest creating the letters only (not combinations)

Create a view called TileView which implements imageview and draw the score on the tile corner using the 2d methods described in the developer guide.

OTHER TIPS

I think im misunderstanding something...

But its a simple customView with a Textview that can be styled, in a relative layout and on bottom right of parent another TextView with another styled textView.

Then you can add this component to each tile of your game.

For the tile you can use your asset as background or define it in an xml.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top