-3

I'm looking for my actionBar to be transparent. I only have searchView in it and it's in my MapActivity, I just want the searchView and the "back pressed" buttons to be visible. Which transparency # code do I use to fill into the following:

 getSupportActionBar().setBackgroundDrawable(new ColorDrawable(parseColor("#")));  
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
iBEK
  • 622
  • 2
  • 8
  • 27
  • https://developer.android.com/reference/android/graphics/drawable/ColorDrawable.html#attr_android:color May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb". – Toris Nov 28 '17 at 19:56
  • Maybe https://stackoverflow.com/questions/30169507/android-how-to-set-color-value-to-transparent –  Nov 28 '17 at 19:57
  • 2
    Possible duplicate of [Android - How to set color value to TRANSPARENT](https://stackoverflow.com/questions/30169507/android-how-to-set-color-value-to-transparent) – AJNeufeld Nov 28 '17 at 19:58
  • Transparency is usually the first channel on a color spec (ARGB) so you may declare it as #FF000000 (Full Transparent black color) – Marcos Vasconcelos Nov 28 '17 at 20:19
  • 2
    @MarcosVasconcelos maybe a typo but #FF000000 is not transparent. It's opaque black. – Toris Nov 28 '17 at 20:23
  • So its #00000000 ?? I always forget thats why I always use #88000000 – Marcos Vasconcelos Nov 28 '17 at 20:32
  • 1
    Yes for #00000000. And NB: setBackgroundDrawable(Drawable background) This method was deprecated in API level 16. use setBackground(Drawable) instead https://developer.android.com/reference/android/view/View.html#setBackgroundDrawable(android.graphics.drawable.Drawable) NB2: background Drawable: The Drawable to use as the background, or null to remove the background – Toris Nov 28 '17 at 20:43
  • I wonder why I'm receiving down votes? The question is very clear. I'm just asking the color code for transparency. It's not too complicated of a question, don't overthink it. – iBEK Nov 28 '17 at 21:01
  • You can also use the short form: #ARGB. So, **#0000**. – Phantômaxx Nov 28 '17 at 21:34

2 Answers2

6

Android supports the #AARRGGBB color format.

A = alpha, R = Red, G = Green, B = Blue

To make some View transparent use #00000000.
First 00 are alpha.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Saheb Roy
  • 161
  • 4
1

You can also try this #ffffff00

Arshad
  • 333
  • 4
  • 10