Search code examples
androiddrawableandroid-4.2-jelly-bean

tileMode="repeat" broken on Android 4.1 jelly bean


My app uses tiled backgrounds in a couple of places, and when I tested in the Android 4.1 Jelly Bean emulator, these backgrounds simply don't show up. I tried putting a regular image in instead, and it shows up fine. So I'm wondering if the tileMode="repeat" had been deprecated or something? Though I can't find any information saying so online. Here's my background xml file:

backrepeat.xml

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

And here is where I use it in my button:

greenchecker_btn.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="false" android:state_enabled="true"
          android:state_focused="false" android:drawable="@drawable/backrepeat" />
    <item android:state_pressed="true" android:state_enabled="true"
          android:drawable="@drawable/backrepeat_over" />
    <item android:state_pressed="false" android:state_enabled="true"
          android:state_focused="true" android:drawable="@drawable/backrepeat" />
    <item android:state_pressed="false" android:state_enabled="false"
          android:state_focused="false" android:drawable="@drawable/backrepeat" />
    <item android:state_pressed="false" android:state_enabled="false"
          android:state_focused="true" android:drawable="@drawable/backrepeat" />

</selector>

Anyone got any idea why this has stopped working in 4.1? Works in all other versions as far as I know. Thanks!

EDIT -

Seem to have solved the problem by replacing the tiling files which were gifs, with pngs.


Solution

  • Seem to have solved the problem by replacing the tiling files which were gifs, with pngs.