2017-09-15 41 views
-1
 <?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 
tools:context=".MainActivity" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content"> 


     <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="CLICK ME" 
     android:id="@+id/textView"> 
     <requestFocus /> 
    </TextView> 
    </RelativeLayout> 

有人可以解決我得到還我面對錯誤的低盤存儲在Android的目錄內我這裏,而不是停留於瀏覽小時後得到任何答案錯誤。如果沒有必要的錯誤compliling xml文件

Error:(24) Error parsing XML: not well-formed (invalid token) 
    C:\Users\abhilasha.abhilasha- 
    PC.000\AndroidStudioProjects\MyApplication\app\src\main\res\layout- 
v17\activity_main.xml 
Error:(2) Error parsing XML: no element found 
Error:Execution failed for task ':app:processDebugResources'. 
> com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: Process 'command 
'C:\Users\abhilasha.abhilasha-PC.000\AppData\Local\Android\sdk1\build- 
tools\26.0.0\aapt.exe'' finished with non-zero exit value 1 
Information:BUILD FAILED 
+1

你甚至試過驗證你的XML嗎? –

+0

當他們沒有分離的結束標記時,用斜線「/」關閉標記。或者甚至更好,使用設計視圖插入元素,然後查看「文本」視圖以查看如何格式化。 – Gotiasits

+0

是的,我曾嘗試驗證,但它並沒有工作。即使我試過用斜線結束標籤,所以我試着分開標籤closings.What我應該試試嗎? –

回答

0

No element found<requestFocus />所以刪除此標籤。

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content"> 

     <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="CLICK ME" 
     android:id="@+id/textView"> 

    </TextView> 
    </RelativeLayout>