4

I'm trying to make an image to serve as my background in a ScrollView. The image appears at Android 2.3 running in a Galaxy 5 and a Galaxy SII lite, but it doesn't at 4.2.2 running in a Galaxy nexus and Asus nexus.

Funny thing is that any other image works but the one i want to use doesn't.

It's a PNG image with a 640x2844 dimension.

I am setting the background like this:

<LinearLayout
    android:id="@+id/ll_flux"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="@drawable/back_status_marca"
      >

Tried with setBackgroundResource(R.drawable.back_status_marca) inside my activity, but didn't work either.

Any idea how might I achieve my background? That is, not changing the image.

rekire
  • 47,260
  • 30
  • 167
  • 264
Dragons_Lair5
  • 715
  • 1
  • 5
  • 16

1 Answers1

1

IMHO it is a bad idea to use a such big background image. If you have a gradient in the background you should better use dot nine patch images.

This images can simply scaled as you like.

rekire
  • 47,260
  • 30
  • 167
  • 264
  • But this image is not a gradient. Do you have any idea ? – Dragons_Lair5 Mar 04 '13 at 20:09
  • That depends a little on the image itself. Could you describe it or attach a thumbnail? – rekire Mar 04 '13 at 20:15
  • an all white images with a few arrows drawn on it, just testes with a lower resolution and it worked, but i need to do something to work with the one with higher resolution. Im thinking in cutting the image in 3 parts and add with a RelativeLayout to mount it behind my other componentes. – Dragons_Lair5 Mar 04 '13 at 20:21
  • I think the 9 patch image should do its job. If I understand your correctly you have a huge white part so you can compress this part to one pixel and let the android scale this pixel row to any hight you need. – rekire Mar 04 '13 at 20:28
  • tried 9 patch and didnt work. I made it work with a 640x2308 resolution, is there a limit size for images to be used in Nexus? – Dragons_Lair5 Mar 06 '13 at 17:31
  • Without any more informations I cannot help you. I think there are some limits, but I don't know them however such huge images are a very bad idea. – rekire Mar 06 '13 at 21:55