How to apply a texture without distorting?

Asked

Viewed 125 times

1

I have a texture like this, which I will apply in various different shapes and sizes, plus table background and table rows.

How to apply it in various sizes without distorting? It is possible?

NOTE: I used the ninepatch but for being a texture, ended up distorting the image.

inserir a descrição da imagem aqui

1 answer

4


Go to your XML drawable and add property tileMode="repeat". For example:

drawable/imagem_de_fundo.xml:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/imagem_de_fundo_real"
    android:tileMode="repeat" />

Then use the @drawable/imagem_de_fundo like your image, it will scale repeating itself instead of receiving zoom.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.