With the support library now fully supporting vector images, I'm trying to switch to vector images as much as I can in my app. An issue I'm running into is that it seems impossible to repeat them.
With bitmap images the following xml could be used:
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/repeat_me"
android:tileMode="repeat"
/>
This does not work, as vector images can not be used in bitmaps: https://code.google.com/p/android/issues/detail?id=187566
Is there any other way to tile/repeat vector images?
I'd like to put a full solution that doesn't require the support library hidden class, written in Kotlin, based on what was suggested in one of the answers (here) :
DrawableWrapper.kt
TilingDrawable.kt
Sample usage:
Thanks to @pskink I made a drawable that tiles another drawable: https://gist.github.com/9ffbdf01478e36194f8f
This has to be set in code, it can not be used from XML:
Check Nick Butcher solution:
https://gist.github.com/nickbutcher/4179642450db266f0a33837f2622ace3
Add TileDrawable class to your project and then set tiled drawable to your image view:
This is the java version of Nick Butcher solution:
You can use this drawable class in code with vector patterns: