0

我正在尝试为 xml 制作自定义控件。但它给出了以下错误

 java.lang.ClassCastException:
     com.tdsoc.android.cardzlib.ui.EventElementView cannot be cast to
     android.view.ViewGroup     at
   android.view.LayoutInflater.rInflate(LayoutInflater.java:624)    at
     android.view.LayoutInflater.inflate(LayoutInflater.java:408)   at
     android.view.LayoutInflater.inflate(LayoutInflater.java:296)   at
    com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:279)
        at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:318)
        at
     com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
        at
    com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
        at
     com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1640)
        at
     com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1391)
        at
     com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.onXmlModelChanged(GraphicalEditorPart.java:1353)  at
     com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegateXmlModelChanged(LayoutEditorDelegate.java:395)
        at
    com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.xmlModelChanged(CommonXmlEditor.java:328)
        at
     com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor$XmlModelStateListener.modelChanged(AndroidXmlEditor.java:1610)
        at
     com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.wrapEditXmlModel(AndroidXmlEditor.java:1084)
        at
     com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.wrapUndoEditXmlModel(AndroidXmlEditor.java:1160)
        at
    com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ActionLinkStyleRange.onClick(GraphicalEditorPart.java:2457)
        at
     com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ErrorLabelListener.mouseUp(GraphicalEditorPart.java:2522)
    at
     org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:219)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)   at
     org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
        at
     org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)     at
     org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)    at
     org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)    at
     org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at
     org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
        at
     org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at
     org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
        at
     org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at
    org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at
    org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at
     org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
        at
     org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
     sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     at
     java.lang.reflect.Method.invoke(Unknown Source)    at
     org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)   at
    org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)   at
    org.eclipse.equinox.launcher.Main.run(Main.java:1410)
4

0 回答 0