问题
I extended the LinearLayout class to create my own custom layout.
It works well when I put it on an Activity, but when I put in an appwidget I get:
02-11 13:16:36.906: W/AppWidgetHostView(6138): Error inflating AppWidget AppWidgetProviderInfo(provider=ComponentInfo{com/com.Provider}): android.view.InflateException: Binary XML file line #2: Error inflating class com.CustomLinaerLayout
Is there a way to put a custom layout on an appwidget?
Thanks.
回答1:
taken from here http://developer.android.com/guide/topics/appwidgets/index.html
A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:
FrameLayout
LinearLayout
RelativeLayout
And the following widget classes:
AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
ViewFlipper
ListView
GridView
StackView
AdapterViewFlipper
Descendants of these classes are not supported.
来源:https://stackoverflow.com/questions/9239772/extend-linearlayout-for-app-widget