Reputation: 14484
I'm trying to create a view in Android
that has rounded corners and also uses a tiled image background (and which appears on top of another view with a tiled background).
I can create a shape drawable for the corners and a bitmap drawable for the tiled image, but I can't see how I can apply them both the same view.
Some things I've attempted:
Nesting the view with the tiled background inside a view with rounded corners - doesn't work, the tiled background just appears on top with square corners
Paint over the corners of the view with rounded corners - this doesn't work because of the tiled background of the view below (otherwise would work fine)
Upvotes: 7
Views: 1728
Reputation: 5140
You can check video which contains a way to do it without using clipPath
which is not supported with hardware acceleration.
Upvotes: 1
Reputation: 38
I believe your custom View should define its drawing region with a Path. You could then draw the Path with a paint and shader doing what you want (fill and tile).
http://developer.android.com/reference/android/graphics/Path.html
Upvotes: 2