tags:

views:

276

answers:

2

Hi!

Can anyone tell me what views can I use in an appWidget?

Thank you!

+3  A: 

See the app widgets article on the Android Developers' site for a list of the layouts and views available for use in a widget.

Christopher
A: 

This list provided by Christopher is technically correct, but it is not quite complete. Although these layouts and views are available, many (most?) of the presentation methods cannot be invoked. For example, if you try to programmatically change the background color of one of the supported widgets (TextView), you will receive a runtime error:

WARN/AppWidgetHostView(606): android.widget.RemoteViews$ActionException: view: android.widget.TextView can't use method with RemoteViews: setBackgroundColor(int)

I've yet to see a definitive list of what is and is not supported. The android-dev list has seen a few threads (one, two) on the topic, but not much more. The work-arounds are not so great.

tommyjr