is there any way to programmatically add a Button to a MapFragment or directly onto a GoogleMap object without using XML?
Thanks!
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.