moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Feature Request: Gracefully handle xml rendering #404

Open Derpalus opened 7 years ago

Derpalus commented 7 years ago

Just a simple suggestion to add functionality so TileViews can be added in xml without having an xml compilation error in Android Studio.

I think it's as easy as adding

if (isInEditMode())
    return;

just after the super call in the constructors of TileView and ZoomPanLayout. But I have never made my own custom view in Android so I don't know if that is all that is required. Perhaps some sort of basic rendering placeholder has to be handled as well?

moagrius commented 7 years ago

is this specific to that layout preview in AS?

Derpalus commented 7 years ago

I don't quite understand what you mean. All I know is I get a render exception when I add a TileView to my view xml and that Android Studio suggests using View.isInEditMode() for custom views to avoid the problem.

moagrius commented 7 years ago

Ok thanks