android - 无法使用 ADT eclipse 在图形布局中打开 Android 布局 xml 文件

标签 android xml layout adt

我是 Android 开发者。我不知道我的 eclipse 包发生了什么,我无法在“图形布局”中打开我的 XML 布局。

我尝试了不同的方案,例如清理项目、重新启动 eclipse 并尝试创建新的工作区。尝试使用不同的 sdk 19、18、17,但我仍然面临同样的问题。

我附上了截图。来自 android 开发人员的任何帮助将不胜感激。

enter image description here

为异常添加完整堆栈。

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x1110014.
    at android.content.res.BridgeResources.throwException(BridgeResources.java:693)
    at android.content.res.BridgeResources.getBoolean(BridgeResources.java:461)
    at android.view.ViewConfiguration.<init>(ViewConfiguration.java:308)
    at android.view.ViewConfiguration.get(ViewConfiguration.java:330)
    at android.view.View.<init>(View.java:3439)
    at android.view.ViewGroup.<init>(ViewGroup.java:459)
    at android.widget.LinearLayout.<init>(LinearLayout.java:168)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:294)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:336)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:334)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:451)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.changed(GraphicalEditorPart.java:718)
    at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationChooser.onRenderingTargetChange(ConfigurationChooser.java:1652)
    at com.android.ide.eclipse.adt.internal.editors.layout.configuration.TargetMenuListener.widgetSelected(TargetMenuListener.java:74)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4136)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3982)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3621)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    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:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

添加 XML 布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ImageView
        android:id="@+id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dp" />

    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#FFF" 
        android:layout_toRightOf="@+id/image"/>
     <Button
        android:id="@+id/dialogButtonOK"
        android:layout_width="100px"
        android:layout_height="wrap_content"
        android:text=" Ok "
        android:layout_marginTop="5dp"
        android:layout_marginRight="5dp"
        android:layout_below="@+id/image"
        />

</RelativeLayout>

最佳答案

尝试更改项目的目标 api。将其设置为低于 Api 级别 19,并从显示在布局上方的栏中更改 api(以图形方式)。并且如果您在 style.xml 中提到的任何其他主题,也将 styles.xml 中的项目主题更改为 android:Theme.Holo.Light 希望它有所帮助..

关于android - 无法使用 ADT eclipse 在图形布局中打开 Android 布局 xml 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22349907/

相关文章:

java - 从自定义适配器访问ArrayList

xml - 过滤没有属性的元素,但使用 XSLT 保留包含其父元素的元素

php - 在 plesk api 中,如果我不知道数据库 ID,如何将用户添加到数据库

css - HTML5/CSS - div 拉伸(stretch)大于 body 100%

android - 包含在 Eclipse 中用于抛出 "no resource found"的布局

layout - 如何在 SwiftUI 中对齐底部文本

android - Google Play 商店错误 DF-BPA-30

java - android studio 自动完成 : how to display constructors with parameters

xml - 不同的默认命名空间中元素的 XPath 是什么?

Android:删除特定 threadId 位置的短信