The best way is to create a rounded corener button with a background that has a repeating bitmap.

I just would like to know the best way to achieve this. I have a button with rounded corners, but I would also like the button background to be a texture that has been tiled.

I would be grateful for any help


source to share

2 answers

Thank you for your suggestions but they don't work :( I ended up doing the inevitable and creating a custom view where I imported the GradientDrawable from my resources where I defined rounded corners etc. and then I also imported mine " texture "as a BitmapDrawable and used by PorterDuffXfermode to mask it. It would be nice to create a shape and then apply to that shape :(.



For rounded corners, check this:

to add an image background, just add it to the resource

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="">
    <shape android:shape="rectangle" android:padding="10dp">
    <corners android:bottomRightRadius="30dp"
             android:topRightRadius="30dp" />
    <bitmap android:src="@drawable/yourfilename" 
            android:tileMode="repeat" />


from: set background image and xml resource



All Articles