Eclipse 中的 Android 应用程序:编辑文本未显示在图形布局上 [英] Android app in Eclipse: Edit text not showing on Graphical layout
问题描述
我试图在 Eclipse 中向我的 Android 应用程序添加一个文本字段,但随后我将 Plain text
选项拖到图形布局上,底部出现一条消息.它读在渲染过程中引发异常:java.lang.System.arraycopy([CI[CII)V]异常详细信息记录在 Window >显示视图错误日志
即使我去 Window >Show View
没有错误日志选项.整个设计器现在没用了,因为我不能再使用它了,直到我直接从 xml 中删除 EditText
.是什么导致了这个错误,我该如何解决?我运行的是最新版本(截至今天,6-30-14)和 Windows 8 Pro x64.
I am trying to add a text field onto my Android app in Eclipse, but then I drag the Plain text
option on to the graphical layout, a message at the bottom comes up. It reads
Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V
Exception details are logged in Window > Show View > Error Log
Even when I go to Window > Show View
there is no error log option. The whole designer is useless now, because I can not use it anymore until I delete the EditText
directly from the xml. What is causing this error, and how do I fix it? I am running the latest version (as of today, 6-30-14), and Windows 8 Pro x64.
这是我的完整布局代码:
Here is my full layout code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:text="@string/welcome_text" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ems="10"
android:inputType="text">
<requestFocus />
</EditText>
</RelativeLayout>
推荐答案
检查渲染布局时使用的 Android 版本"并确保您使用的不是以W"结尾的 Android Wear 版本(例如 API 20:Android 4.4W).我认为 Wear 不支持 EditText
.
Check the "Android version to use when rendering layouts" and make sure you're not using a version that ends in "W" for Android Wear (e.g. API 20: Android 4.4W). I don't believe Wear supports EditText
.
在 Android Studio 和 Eclipse 中,它是布局预览工具栏中带有绿色 android 的下拉列表.您可能希望明确设置它并且不允许 IDE 自动选择 Android 版本.
In both Android Studio and Eclipse, it's the dropdown with the green android in the layout preview's toolbar. You may want to set it explicitly and not allow the IDE to choose the Android version automatically.
这篇关于Eclipse 中的 Android 应用程序:编辑文本未显示在图形布局上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!