我对布局很新,但我能够成功地制作一个非常好看的布局(对于平板电脑).在Eclipse中,它运行良好.我在Android 4.0(ICS)上使用'目标'完成了所有操作,但显然我的平板电脑只运行3.0(Honeycomb).当我意识到错误时,我将查看器/编辑配置更改为3.2,但Eclipse甚至不再显示布局的图形,它只是吐出:
com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- GridLayout (Change to android.widget.GridLayout, Fix Build Path, Edit XML)
Run Code Online (Sandbox Code Playgroud)
弹出错误日志:
java.lang.ClassCastException: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:84)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:86)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at android.view.LayoutInflater.inflate(LayoutInflater.java:367)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:321)
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:1317)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1071)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ConfigListener.onConfigurationChange(GraphicalEditorPart.java:493)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.onRenderingTargetChange(ConfigurationComposite.java:2192)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.access$4(ConfigurationComposite.java:2157)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite$2.widgetSelected(ConfigurationComposite.java:441)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个简单的清单.
我有这个:
String valuesArray[] = {"473", "592", "1774", "341", "355", "473", "950", "500", "44", "946.35", "750", "950"};
List<String> valueList = Arrays.asList(valuesArray);
Run Code Online (Sandbox Code Playgroud)
每当我尝试向列表添加内容时,它都会强制关闭.
valueList.add("Test");
Run Code Online (Sandbox Code Playgroud)
它似乎只有在我尝试添加到列表时才会发生.我可以从列表中获取值,只是不添加它.