Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tileMode repeat in drawable won't work [duplicate]

Tags:

android

I have this drawable resource:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/bg_stripe"
    android:tileMode="repeat"
    android:antialias="true"
    android:dither="false"
    android:filter="false"
    android:gravity="left"
/>

used as background here:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_world_locked" >

Sometimes everything works well, sometimes not (the drawable resource appears in its real small size and not repeated). Why? It's an Android bug? I run this on my HTC Desire Android 2.3.

like image 518
VanDir Avatar asked Apr 10 '13 11:04

VanDir


1 Answers

Unfortunately yes - it's Android bug. Check this answer

Tiled drawable sometimes stretches

In short: you should set repeating in Java code instead of XML.

like image 120
kamil zych Avatar answered Jan 20 '23 18:01

kamil zych