2016-08-26 60 views
0

我一直在處理這個XML代碼,並得到錯誤,指出重複的錯誤屬性,我經歷了代碼,但找不到解決方案。屬性XML中的重複錯誤

這是我的XML代碼:被表現爲

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

    <TextView 
     android:id="@+id/wf" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginBottom="20dp" 
     android:paddingTop="10dp" 
     android:text="WIMBELDON FINALS" 
     android:textSize="25sp" 
     android:textStyle="bold" /> 


    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="60dp" 
     android:orientation="horizontal"> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:orientation="vertical" 
      tools:context="com.example.vidit.project2.MainActivity"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="20dp" 
       android:text="roger federer" 
       android:textAllCaps="true" 
       android:textSize="15sp" /> 

      <TextView 
       android:id="@+id/r" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="20dp" 
       android:text="0" 
       android:textSize="25sp" /> 

      <Button 
       android:id="@+id/score1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:onClick="scorer" 
       android:text="POINT" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="20dp" 
       android:text="Sets Won: " 
       android:textAllCaps="true" 
       android:textSize="20dp" /> 

      <TextView 
       android:id="@+id/setr" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="10dp" 
       android:text="0" 
       android:textSize="25dp" /> 


     </LinearLayout> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:orientation="vertical" 
      tools:context="com.example.vidit.project2.MainActivity"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="20dp" 
       android:text="djokovic" 
       android:textAllCaps="true" 
       android:textSize="15sp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="20dp" 
       android:text="0" 
       android:textSize="25sp" /> 

      <Button 
       android:id="@+id/score2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="POINT" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="20dp" 
       android:text="Sets Won: " 
       android:textAllCaps="true" 
       android:textSize="20dp" /> 

      <TextView 
       android:id="@+id/setd" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:paddingTop="10dp" 
       android:text="0" 
       android:textSize="25dp" /> 


     </LinearLayout> 


    </LinearLayout> 

    <Button 
     android:id="@+id/reset" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:onClick="reset" 
     android:text="RESET" /> 
</RelativeLayout> 

的錯誤:錯誤解析XML重複的屬性。

請引導我。

謝謝

+1

'xmlns:android =「http://schemas.android.com/apk/res/android」 xmlns:android =「http://schemas.android.com/apk/res/android」'.. 。 – njzk2

回答

0

只是把我的頭頂部之我見「的xmlns:機器人」在你的根RelativeLayout的出現兩次;嘗試刪除其中的一個,看看是否有這個竅門!