我正在使用Android 4.2和Eclipse indigo(3.7.0)。我用6行创建了一个TableLayout
。我想在eclipse中使用图形布局在一行中添加一个TextView
和一个EditText
。无增加TextView
但是当我拖放EditText
问题,会显示以下错误:无法在TableLayout中放置文本编辑器
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>
您可能没有写任何代码,但Eclipse有,在左下方有标签“图形视图”,单击其他选项卡(与您的文件的名称),并编辑到您的问题的代码。 – Sam 2012-07-18 17:36:59
我从xml视图中剪切和粘贴代码: – mwalsh 2012-07-18 18:14:23
我遇到了其他问题,所以我最终重新安装了android和eclipse。它正在工作。感谢所有回应。 – mwalsh 2012-07-19 15:45:41