0

I have some code (android source), and Im trying to set Opacity of a LayoutParam

First, I've got this

mLayoutParams = new WindowManager.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            height,
            WindowManager.LayoutParams.TYPE_STATUS_BAR,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
                | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
            // Setup statusbar transparency preference
             mOpacity != 100 ? PixelFormat.TRANSPARENT : PixelFormat.RGB_565);

Then I register a SettingsObserver, for reloading mOpacity, but if I set Opacity back to 100, it wont be RGB_565, as LayoutParams have defined TRANSPARENT Format. I'd like to know if there is some way for setting up this standalone, because If I add to obsever the whole code, it ends up into creating infinite Layouts, and overlaying them. Another useful thing would be how to destroy mLayoutParams before creating a new One.

Thanks in Advance.

user809486
  • 888
  • 1
  • 7
  • 15

1 Answers1

0

Very easily fixed. I just replaced

 mOpacity != 100 ? PixelFormat.TRANSPARENT : PixelFormat.RGB_565

by only

  PixelFormat.TRANSPARENT

Then, When I wanted to set 100% Opacity, I just sent a hex value that equals to 100 :)

user809486
  • 888
  • 1
  • 7
  • 15