The Android MapView is great in many ways, but it is missing some handy user interaction listeners implementations. That is why the MapView APIs are incomplete.

Let’s say we would like to track user interaction with the map in those cases :

When the user

  • Starts Zooming in on the map
  • Stops Zooming in on the map
  • Starts Zooming out the map
  • Stops Zooming out the map
  • Rotates the map
  • Pans the map

Those map interactions seem very simple and interesting for the analytics team to track. …


image source

The MaterialShapeDrawable was introduced in Material Design 2.0.
For building MaterialShapeDrawable we are going to need ShapeAppearanceModel. According to documentation, the ShapeAppearanceModel models the edges and corners of a shape, which are used by MaterialShapeDrawable to generate and render the shape for a view’s background. Here is MaterialShapeDrawable with rounded corners example:

val shapeAppearanceModel = ShapeAppearanceModel().toBuilder().setAllCornerSizes(12F) 
val materialShapeDrawable = MaterialShapeDrawable(shapeAppearanceModel).apply {
setTint(Color.YELLOW)
paintStyle = Paint.Style.FILL
}
view.backgoround = materialShapeDrawable

After the introduction to MaterialShapeDrawable let’s create the slashed custom view:

Matso Abgaryan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store