2012-07-18 21 views
1

我正在使用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> 
+0

您可能没有写任何代码,但Eclipse有,在左下方有标签“图形视图”,单击其他选项卡(与您的文件的名称),并编辑到您的问题的代码。 – Sam 2012-07-18 17:36:59

+0

我从xml视图中剪切和粘贴代码: – mwalsh 2012-07-18 18:14:23

+0

我遇到了其他问题,所以我最终重新安装了android和eclipse。它正在工作。感谢所有回应。 – mwalsh 2012-07-19 15:45:41

回答

1

我在Eclipse中试过你的代码,我没有任何问题。一切正常。检查您的SDK是否是SDK Manager中的最新版本,或者您的所有插件是否已更新。图形布局是用户友好的,但不是开发友好的。