當我嘗試調試我的應用程序時,當我在佈局中包含此xml時,我得到一個runtimeexception。我看不出有什麼問題,你能嗎? 我正在使用android eclipse插件,eclipse 3.5.2,最新的android插件和最新的java 6 ... 21在winxppro 32位sp3上 謝謝。在這個android佈局xml塊中有什麼bug
<ImageButton android:id="@+id/map_button"
android:src="@drawable/bot_map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageButton android:id="@+id/filter_button"
android:src="@drawable/bot_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageButton android:id="@+id/sort_button"
android:src="@drawable/bot_sort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageButton android:id="@+id/prev_button"
android:src="@drawable/bot_arrow_prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageButton android:id="@+id/next_button"
android:src="@drawable/bot_arrow_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
我也得到這些異常在同一時間:
java.lang.IllegalArgumentException異常:參數不能爲空 在org.eclipse.swt.SWT.error (SWT.java:3865) at org.eclipse.swt.SWT.error(SWT.java:3799) at org.eclipse.swt.SWT.error(SWT.java:3770) at org.eclipse.swt .widgets.TreeItem.checkNull(TreeIt em.java:205) 在org.eclipse.swt.widgets.TreeItem。(TreeItem.java:195) 在org.eclipse.gef.editparts.AbstractTreeEditPart.addChildVisual(AbstractTreeEditPart.java:75) 在org.eclipse .gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:210) at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:771) at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart .java:718) at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:252) at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:211) at org.eclipse .gef.editparts.RootTreeEditPart.setContents(RootTreeEditPart.java:140) at org.eclipse.gef.ui.parts.AbstractEditPartVi ewer.setContents(AbstractEditPartViewer.java:617) at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents(AbstractEditPartViewer.java:626) at com.android.ide.eclipse.adt.internal.editors.layout。 gle1.UiContentOutlinePage.reloadModel(Unknown Source) at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.xmlModelChanged(Unknown Source) at com.android.ide.eclipse.adt.internal.editors。 AndroidXmlEditor $ XmlModelStateListener.modelChanged(Unknown Source) at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel.fireModelChanged(AbstractStructuredModel.java:553) at org.eclipse.wst.sse.core.internal.model .AbstractStructuredModel.internalModelChanged(AbstractStructuredModel.java:887) at org.eclipse.wst.sse.core.internal.model.AbstractStructuredMode org.eclipse.wst.xml.core.internal.document.DOMModelImpl.changedModel(DOMModelImpl.java:167) (org.eclipse.wst.sse.core.internal)處的l.changedModel(AbstractStructuredModel.java:382) 。 (org.eclipse.wst.sui.ui.StructuredTextViewerUndoManager.undo(StructuredTextViewerUndoManager.java:183) at org.eclipse.jface.text.TextViewer.doOperation(TextViewer。 java:3938) at org.eclipse.jscript.SourceViewer.doOperation(SourceViewer.java:921) at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1533) at org.eclipse.wst.sui.ui.internal.StructuredTextViewer.doOperation(StructuredTextViewer.java:604) at org.eclipse.ui.texteditor.TextO在org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129)上使用) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185) at org.eclipse.ui。internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109) 在org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) 在org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand。的java:508) 在org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) 在org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470) 在org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui。 internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.k eys.WorkbenchKeyboard.access $ 3(WorkbenchKeyboard.java:510) at org.eclipse.ui.internal.keys.WorkbenchKeyboard $ KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125) at org.eclipse.swt.widgets.EventTable.sendEvent (EventTable.java:84) 在org.eclipse.swt.widgets.Display.filterEvent(Display.java:1208) 在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002) 在有機.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.sendKeyEvent (Widget.java:1040) 在org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036) 在org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1368) 在有機.E clipse.swt.widgets.Control.WM_CHAR(Control.java:4053) at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:346) at org.eclipse.swt.widgets.Control.windowProc( (org.eclipse.swt.widgets.Display.windowProc(Display.java:4619) at org。)。 eclipse.swt.internal.win32.OS.DispatchMessageW(本地方法) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2411) at org.eclipse.swt.widgets.Display.readAndDispatch (Display.java:3501) 在org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) 在org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) 在有機.eclipse.ui.internal.Workben在org.eclipse.ui.internal.Workbench $ 5.run(Workbench.java:500) (在org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm。 java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui。 internal.ide.application.IDEApplication.start(IDEApplication.java:113) 位於org.eclipse.core.runtime.internal的org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) 。 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:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0 (本機方法) 在sun.reflect.NativeMethodAccessorImpl.invoke(來源不明) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(來源不明) 在java.lang.reflect.Method.invoke(來源不明) 在org.eclipse .equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main 。Java的:1311)
我們可以看到該代碼片段的封閉佈局嗎? – blindstuff 2010-10-29 20:51:12
如果這是您的整個XML文件,那麼您缺少一個根元素 - 包含所有這些按鈕的佈局。如果這不是全部 - 請完整發布您的XML – Asahi 2010-10-29 22:44:39