2017-09-15 93 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>