Mick Byrne
Mick Byrne

Reputation: 14484

Android - How to create a view with rounded corners and a tiled image background?

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:

Upvotes: 7

Views: 1728

Answers (2)

Daniel L.
Daniel L.

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

smokeandmirrors
smokeandmirrors

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

Related Questions