4

I know how to make a background pattern repeating a bitmap. I also saw a way to combine two bitmaps using Canvas. But I want to make a repeating bitmap in combination with a gradient drawable to make a background. I have a .png file that it's partially transparent and I want to repeat it along with a gradient drawable (normal gradient XML).

This is the PNG: http://subtlepatterns.com/?p=1203

Is there a way to do this?

Thanks in advance.

0

1 Answer 1

10

You can use an XML bitmap to create a tile pattern:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/my_png"
    android:tileMode="repeat" />

Then you should be able to use this as part of a LayerList drawable that also includes your gradient. Then use the layer list as the background drawable.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.