Best way to draw tournament bracket in Android

2019-07-30 13:26发布

问题:

I need to draw a tournament bracket in Android. I already calculated the positions for all games (i.e. an (x,y) tuple that defines where to place teams in a spreadsheet-like structure). However, I don't know the preferred way of drawing the bracket. I found an example that shows what I need:Example

My first idea was to programmatically create and fill a TableLayout. However, borders are not really supported and a lot of TextViews are needed to fill the space between games. So I am not sure if this is the best way to do it.

Does anyone have better suggestions or maybe even an example of something similar?

回答1:

I'd suggest custom drawing using Canvas. That way you can draw wherever it makes sense and probably even support zooming without too much work.