提问者:小点点

Eclipse中的Android应用程序:编辑图形布局上不显示的文本


我试图在Eclipse中的Android应用程序上添加一个文本字段,但随后我将纯文本选项拖到图形布局上,底部会出现一条消息。它读取呈现期间引发的异常:java。lang.System。arraycopy([CI[CII)V异常详细信息记录在窗口中

以下是我的完整布局代码:

<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>

共3个答案

匿名用户

检查“渲染布局时要使用的Android版本”,并确保在Android Wear中没有使用以“W”结尾的版本(例如API 20:Android 4.4W)。我不相信Wear支持EditText

在Android Studio和Eclipse中,它是布局预览工具栏中带有绿色Android的下拉列表。您可能希望显式设置它,而不允许IDE自动选择Android版本。

匿名用户

在EclipseIDE中,只需将API版本更改为用于预览,如下面的屏幕截图所示。手动选择适合您的选项(API 17适用于我),而不是“自动选择最佳选项”。

匿名用户

我把我的Android版本改为Android4.2,但它仍然不适合我。我尝试了不同的解决方案,发现只有删除Android4.4W软件包才有效。