2012-08-12 27 views
9

當試圖查看圖形佈局視圖我收到以下錯誤:安卓以下類不能被發現 - 的EditText(更改爲android.widget.EditText,修復構建路徑,編輯XML)

The following classes could not be found - EditText (Change to android.widget.EditText, Fix Build Path, Edit XML)

該應用程序工作正常,我可以編輯XML沒有任何問題。我無法再加載圖形佈局視圖。在Main.java文件中,從Android庫導入EditText小部件時沒有問題或錯誤。

我正在使用Eclipse Indigo Service Release 2.獲得了所有最新更新。

我還使用了最新的Android SDK工具20.0.1

這裏是源。我試過選擇Source> Cleanup Document and Format來確保XML是正確的。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="63dp" 
     android:text="@string/button1" /> 

    <EditText 
     android:id="@+id/editText1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginTop="16dp" 
     android:ems="10" 
     android:inputType="" > 

     <requestFocus /> 
    </EditText> 

</RelativeLayout> 

我設法解決了這個問題。

我不得不改變

android:inputType="" to android:inputType="text"

圖形佈局視圖現在可以試。

+0

其中'IDE'您正在使用? – 2012-08-12 17:09:11

+2

請發佈您的XML代碼。 – Swayam 2012-08-12 17:13:17

+0

它是Eclipse嗎?檢查XML中是否缺少第一個小於字符<。 – SSG 2012-08-12 17:11:21

回答

相關問題