Extend LinearLayout for App Widget

蹲街弑〆低调 提交于 2019-12-10 11:55:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!