#android #layout #widget
#Android #макет #виджет
Вопрос:
Я хочу создать один виджет в Android.Я выполняю следующие шаги.
1.I designed on panel which is the subclass of linear layout(panel.java).
2.while designing the widget layout I am using this panel as background.
3.While adding the view in the launcher I am getting the following exception.
Is it possible to add a custom layout in the appwidget layout design.
83): cdmaDbmEcioToSignal(cdmaDbm:-81, cdmaEcio:-145)
D/PhoneWindow( 764): DebugMonitor class=com.android.settings.AppWidgetPickActivity focus=false
W/AppWidgetHostView( 176): updateAppWidget couldn't find any view, using error view
W/AppWidgetHostView( 176): android.view.InflateException: Binary XML file line #6: Error inflating class com.i10n.panel.TransparentPanel
W/AppWidgetHostView( 176): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
W/AppWidgetHostView( 176): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
W/AppWidgetHostView( 176): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
W/AppWidgetHostView( 176): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
W/AppWidgetHostView( 176): at android.widget.RemoteViews.apply(RemoteViews.java:900)
W/AppWidgetHostView( 176): at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:208)
W/AppWidgetHostView( 176): at android.appwidget.AppWidgetHost.createView(AppWidgetHost.java:217)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.frames.screen.ScreenFrame.a(ScreenFrame.java:1169)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.frames.screen.ScreenFrame.handleMessage(ScreenFrame.java:621)
W/AppWidgetHostView( 176): at com.jiubang.core.framework.frame.MessageManager.send(MessageManager.java:60)
W/AppWidgetHostView( 176): at com.jiubang.core.framework.frame.MessageSender.sendMessage(MessageSender.java:75)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.DiyScheduler.f(DiyScheduler.java:2563)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.DiyScheduler.onActivityResult(DiyScheduler.java:1804)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.DiyScheduler.d(DiyScheduler.java:2417)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.DiyScheduler.a(DiyScheduler.java:2389)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.DiyScheduler.onActivityResult(DiyScheduler.java:1798)
W/AppWidgetHostView( 176): at com.jiubang.ggheart.apps.desks.diy.GoLauncher.onActivityResult(GoLauncher.java:295)
W/AppWidgetHostView( 176): at android.app.Activity.dispatchActivityResult(Activity.java:3868)
W/AppWidgetHostView( 176): at android.app.ActivityThread.deliverResults(ActivityThread.java:3500)
W/AppWidgetHostView( 176): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3546)
W/AppWidgetHostView( 176): at android.app.ActivityThread.access$2700(ActivityThread.java:126)
W/AppWidgetHostView( 176): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1962)
W/AppWidgetHostView( 176): at android.os.Handler.dispatchMessage(Handler.java:99)
W/AppWidgetHostView( 176): at android.os.Looper.loop(Looper.java:123)
W/AppWidgetHostView( 176): at android.app.ActivityThread.main(ActivityThread.java:4595)
W/AppWidgetHostView( 176): at java.lang.reflect.Method.invokeNative(Native Method)
W/AppWidgetHostView( 176): at java.lang.reflect.Method.invoke(Method.java:521)
W/AppWidgetHostView( 176): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
W/AppWidgetHostView( 176): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
W/AppWidgetHostView( 176): at dalvik.system.NativeStart.main(Native Method)
W/AppWidgetHostView( 176): Caused by: java.lang.ClassNotFoundException: com.i10n.panel.TransparentPanel in loader dalvik.system.PathClassLoader@4001b710
W/AppWidgetHostView( 176): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
W/AppWidgetHostView( 176): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
W/AppWidgetHostView( 176): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
W/AppWidgetHostView( 176): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
W/AppWidgetHostView( 176): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
W/AppWidgetHostView( 176): ... 29 more
Могу ли я использовать пользовательский макет в appwidgets.
Ответ №1:
Виджеты главного экрана поддерживают очень ограниченное количество стандартных представлений. Вы не можете использовать пользовательский вид или макеты для них. Смотрите Виджеты приложений.