views:

37

answers:

1

I'm making a drawing app. In the centre of the screen, I want the app to contain the user's drawing. At the top of the screen I want buttons for different drawing tools. When a drawing tool is selected, I want buttons specific to that tool to appear at the bottom of the app (e.g. the brush tool might show a "increase brush size" button at the bottom of the screen), replacing what buttons might be there from before. What's a good way to do this?

At the moment, I'm using a relative layout for the whole GUI, then adding a separate linear layout for each tool panel at the bottom of the screen (i.e. the panels overlap when shown together). When a tool button is clicked, I hide all the settings panels except for the one related to the selected tool. This seems a bit messy but I'm not sure how else to do it. It would be nice if I could do it in a way that keeps the code modular for each tool.

+1  A: 

Use a ViewSwitcher for your tools.

CommonsWare