Hi all, Basically, I want to set a repeating background on a given ImageView when loading an image from network. Easy stuff to do. But I'm facing a strange problem using a dedicated drawable with tileMode set to repeat. Actually, sometimes the source image is correctly repeated, sometimes it's not, which obviously makes the background very ugly cause the source image is stretched. The problem occurs randomly (on both emulator and G1). I'm using the following XML (background.xml) to define my repeating background:
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/back" android:tileMode="repeat"> </bitmap> and I use it this way: <ImageView android:id="@+id/header_image" android:layout_width="fill_parent" android:layout_height="@dimen/header_image_height" android:background="@drawable/background"> </ImageView> This works perfectly... sometimes. Of course, I can do the same thing using that code: Bitmap mBackBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.back); BitmapDrawable mBackgroundDrawable = new BitmapDrawable(getResources(), mBackBitmap); mBackgroundDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); mHeaderImage.setBackgroundDrawable(mBackgroundDrawable); This works very well... always! ^_^ But it sounds a little bit dumb to do it myself through code: it seems easier to maintain it from XML and this background is used in so many layouts in my application. Has anyone already faced this problem? Am I missing something? Any guess is welcome. Thanks. Vince -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

