An easy way of making a bitmap repeat is to create an XML file in the drawable folder which looks something like this:
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/background" android:tileMode="repeat" /> "background" is a PNG in the same folder, it doesn't sound like you need a 9 patch in this case. Simply assign @drawable/repeatingbackground or whatever you called the file, in place of the original bitmap. As for rounding corners, you can subclass the view you are rendering (let's say an ImageView) and use clipping to mask the corners, there are a few examples here: http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-to-have-rounded-corners I'm presenting techniques here that are more generalised and re-useable and not a specific one-off which could be better performance-wise (so if you are making a component that's like a progress bar, you'd do this clipping and repeat-bitmap drawing in the onDraw() rather than increasing rendertime by compositing a separate RoundedImageView and a repeatable BitmapDrawable described above). Rich On 13 Jan 2011, at 08:07, Muhammad Ali wrote: > You can create a bitmap in memory, using your own file and draw it in > background. It will help you like the repeat image. > > > > On Jan 12, 1:57 pm, liordav <[email protected]> wrote: >> Hi, >> I have an image I want to use as a background to some layout. >> the problem is the image contains a texture of slant lines, so if i >> use a 1 pixel width image or a 9 patch the image is stretched and the >> texture is Twitching, so i can see the slant lines as latitude lines. >> I saw that he android emulator uses a similar texture in the progress >> bar indeterminate animation, is there a special/simple definition to >> order the background image to repeat itself rather than stretch? is >> there a way to do it with 9 patch, cause eventualy i also need the >> corners to be round. >> thanks for the help. > > -- > 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 -- 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

