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
  • 182,484
  • 112
  • 300
  • 368
  • 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,184
  • 2
  • 53
  • 47
Janusz
  • 182,484
  • 112
  • 300
  • 368
0

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

Ry-
  • 209,133
  • 54
  • 439
  • 449
Paul Grime
  • 14,840
  • 4
  • 34
  • 57
  • 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