3

I would like to change the transparency of a whole View in Android. How can I do that? The View has a nontransparent background.

Janusz
  • 187,060
  • 113
  • 301
  • 369
  • So if it's the main screen you want to be able to see the android home page or you want all the containers less transparent and the background same transparency? – weakwire Jul 14 '10 at 12:55
  • possible duplicate of [How to Set Opacity (Alpha) for View in Android](http://stackoverflow.com/questions/2838757/how-to-set-opacity-alpha-for-view-in-android) – Ry- Aug 23 '12 at 04:09

2 Answers2

5

Since API Version 11 it is possible to set the opacity of a view with setAlpha().

For older Versions it may be possible with the NineOldAndroids backport of View property animations.

BladeCoder
  • 12,779
  • 3
  • 59
  • 51
Janusz
  • 187,060
  • 113
  • 301
  • 369
0

View.setBackgroundDrawable. Use a ColorDrawable with the appropriate alpha value?

Ry-
  • 218,210
  • 55
  • 464
  • 476
Paul Grime
  • 14,970
  • 4
  • 36
  • 58
  • That is only possible if I use a Color as a background. What if I use a drawable? I could always change the alpha of png that is shown as the background manually but that seems to be a bad solution for some cases. – Janusz Jul 14 '10 at 13:16