1

我正在使用 Android 4.2 和 Eclipse indigo (3.7.0)。我创建了一个TableLayout6 行。我想在 Eclipse 中使用图形布局在一行中添加一个TextView和一个。EditText添加没问题TextView,但是当我拖放时EditText,显示以下错误:

NOTE: This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first.
java.util.LinkedHashMap.eldest()Ljava/util/Map$Entry;

我还没有写任何代码。当我第一次创建项目时,任何代码都是由 eclipse 生成的。editText 包含在 xml 中,但图形布局无法显示它。我剪切并粘贴了xml:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1,2,3" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <EditText
                android:id="@+id/editText1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ems="10" >

                <requestFocus />
            </EditText>

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

</TableLayout>
4

2 回答 2

1

我在 Eclipse 中尝试了您的代码,但没有任何问题。一切正常。在 SDK 管理器中检查您的 SDK 是否是最新的,或者您的所有插件是否都已更新。图形布局对用户友好,但对开发人员不友好。

于 2012-07-18T19:09:20.573 回答
0

尝试将其添加到您的 EditText 上:

android:inputType="textNoSuggestions"

加载布局时出现异常:java.util.LinkedHashMap.eldest()Ljava/util/Map$Entry;

于 2012-07-18T20:06:28.183 回答