Search code examples
androidandroid-appwidget

Semi-transparent AppWidget?


I have an AppWidget where the layout has a LinearLayout at the root. The widget uses a background 9-patch to provide a frame for the widget.

How do I set the alpha channel on the widget?

I can't set it directly as the background attribute is being used to specify the 9-patch. It's a LinearLayout not an ImageView, so I can't use setAlpha(), so how do I make it semi-transparent?

The transparency level will change dynamically, so I am unable to use a semi-transparent bitmap.


Solution

  • As far as I can see the only way to do this is to use a semi-transparent drawable (perhaps a 9patch) as there appears to be no way to do it via RemoteViews.