Jonas
Jonas

Reputation: 128827

How to add Views dynamically or on top of other components?

I use a LinearLayout and first I have a MapView and below the map I have a TableLayout with informations fields.

Now I would like to add additional information fields (e.g. a new TableLayout) when the user select a specific menu item on the Options Menu. I would like to have these fields either between the MapView and the TableLayout, or on top of the bottom area of the MapView.

How can I add this TableLayout with additional information fields dynamically after the user has selected a menu item? How can I show it below the MapView or on top of the bottom area of the MapView?

Upvotes: 1

Views: 1196

Answers (1)

xandy
xandy

Reputation: 27411

Consider using ViewStubs for hidden on-demand view. If you need to display something on top of other view, you can use another container to hold the MapView and the stub, FrameLayout could be a good candidate.

Upvotes: 2

Related Questions