I am trying to create a view in Android that has rounded corners and also uses a background with a tiled image (and which appears on top of another view with a mosaic background).
Android
I can create a shape suitable for corners and a bitmap designed for a tiled image, but I donβt see how I can apply them to one view.
Some things I tried:
Nesting a view with a tiled background inside a view with rounded corners - does not work, the tiled background just appears on top with square corners
Paint on the corners of the view with rounded corners - this does not work due to the tiled background below (otherwise it will work fine)
I believe that your custom view should define the drawing area using Path. Then you can draw a Path with paint and a shader, doing what you want (fill and tile).
http://developer.android.com/reference/android/graphics/Path.html
You can check out the video , which contains a way to do this, without using clipPath , which is not supported by hardware acceleration.
clipPath