0

How can I fill entire ImageView background with small image (eg. 2x2px)?
I have found many answers how to stretch image to fill ImageView but I can't find one how to multiple image to fill whole ImageView.

If in ImageView it's imposible it could be any other View.

WojciechKo
  • 1,511
  • 18
  • 35

1 Answers1

5

Create a bitmap xml for your image:

drawable/tiled_background.xml

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

Note the android:tileMode="repeat" line - it will make the image tile over the background. And now simple assign the xml as the background:

Kelevandos
  • 7,024
  • 2
  • 29
  • 46