简体   繁体   中英

Create Custom view in Android

I need to create a Custom view in android which will have dynamic text like price, address etc. and also an ImageView inside it as shown in the image below. I tried to find google some tutorial for custom view but didn't find something satisfactory to do all these things. I also need to use onClick event on this view. Please guys, some code would be of great help. I'm a novice to android. I read google tutorial to create custom view but couldn't implement this. https://lh4.ggpht.com/HmwmRTx3g9ddkHbgvZXpZOB3Am-O9OQARQ2qpxJ16zTDZbG57CmvgxUC75sGFzC3cqrH

Thanks for attention.

This is called Custom Overlay for MapView.

You can check example and implement as per your requirement - Android MapView Balloons

You can use FrameLayouts. It is very simple to use. FrameLayout can add several views on top of each other. It creates a stack of the views. Just add whatever views you want to inside FrameLayout and use the property setVisibility() to control when to show which view.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM