tpei
tpei

Reputation: 681

Programmatically add Button to MapFragment / GoogleMap

is there any way to programmatically add a Button to a MapFragment or directly onto a GoogleMap object without using XML?

Thanks!

Upvotes: 1

Views: 363

Answers (1)

Emil Adz
Emil Adz

Reputation: 41099

Of course there is, well not directly to the map fragment, but you can place any layout you want above it (LinearLayout, RelativeLayout...) in your layout file and then add a view to this layout programmaticly as you would with another, using this method:

layout.addView(YourButtonYouWantToAdd);

That way your button will appear on top of your map fragment.

Upvotes: 1

Related Questions