2

I have background of my LinearLayout a PNG file with 1440x2560 resolution 8 alpha with some transparency. When I run it, Android displays the whole background of the LinearLayout black and only shows ImageButtons and TextViews.

I read that this is possibly because of the transparency but how can I fix it when I already have:

<LinearLayout
android:background="@drawable/background"/>

as my background and I can't set it transparent from there. Also I get

 E/OpenGLRenderer: GL error:  Out of memory!

enter image description here

Nikola
  • 890
  • 1
  • 11
  • 35
  • THere's nothing behind your linear layout. When there's nothing behind it, it will display white or black depending on the device. So you're transparent, but you're transparent over a black image. WHat effect did you want? If you wanted to show transparently on top of the previous activity, you need to set your Activity's theme to do so. – Gabe Sechan Jan 25 '16 at 21:49
  • Yes, I want to show transparently on top of the previous activity. But the problem is that the rectangle that is the actual background (non transparent part) shows black as well. – Nikola Jan 25 '16 at 21:51
  • 2
    See http://stackoverflow.com/questions/2176922/how-to-create-transparent-activity-in-android for how to create a transparent Activity. As for the image itself not showing- it may just be too big, if you're seeing render OOM errors. I'm not an expert on Open GL, but I seem to remember some devices not doing much over 1400x2000. Try a small image, see if it works, then try to debug from there? – Gabe Sechan Jan 25 '16 at 21:57
  • Your PNG is too big, resize it and make it smaller. – Stanojkovic Jan 25 '16 at 22:06

1 Answers1

0

That's because of transparent of course which you already added it.

You can try to add this :

android:alpha="0.4"

Check this out too: How to set transparency of a background image Android xml file

Community
  • 1
  • 1
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
  • This really seems the way to do it but it does not work. Also the non transparent part would be made transparent this way. – Nikola Jan 25 '16 at 21:52