2016-10-07 6 views
1

は、私が「< <前」または「次へ>>」として、ボタンのテキストを設定した場合にのみ、このエラーが発生します。
興味深いのは、私は特定のXMLでのボタンのテキストとして「前< <」を設定した場合はエラーが表示されないことです。
私は両方のXMLファイルを添付した:エラーを示しエラー:XMLパース(143)エラー:整形式ではない(無効なトークン)

XMLファイル:エラーが表示されない

<RelativeLayout 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" 
android:background="@drawable/background111" 
tools:context=".Register_Page2"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:layout_gravity="center" 
    android:fillViewport="true" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:orientation="vertical" 
     android:paddingBottom="30dp" 
     android:paddingLeft="20dp" 
     android:paddingRight="20dp"> 


     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="left" 
      android:layout_marginTop="20dp" 
      android:text="* Required" 
      android:textColor="@color/Item_Red"></TextView> 

     <RelativeLayout 
      android:id="@+id/relativelayout_q1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:id="@+id/q4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10dp" 
       android:text="Have you completed an IELTS examination? *" 
       android:textColor="@color/black" 
       android:textSize="23dp"></TextView> 

      <RadioGroup 
       android:id="@+id/radioGroup4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/q4" 
       android:layout_marginTop="10dp"> 

       <RadioButton 
        android:id="@+id/radio_q4_1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="YES" /> 

       <RadioButton 
        android:id="@+id/radio_q4_2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="NO" /> 

       <RadioButton 
        android:id="@+id/radio_q4_3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="CURRENTLY TRAINING FOR THE IELTS EXAM" /> 

      </RadioGroup> 
     </RelativeLayout> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_marginBottom="5dp" 
      android:layout_marginTop="5dp" 
      android:background="@android:color/darker_gray" /> 

     <RelativeLayout 
      android:id="@+id/relativelayout_q2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:id="@+id/q5" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10dp" 
       android:text="Do you have a Graduate Degree or Master's Diploma? *" 
       android:textColor="@color/black" 
       android:textSize="23dp"></TextView> 

      <RadioGroup 
       android:id="@+id/radioGroup5" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/q5" 
       android:layout_marginTop="10dp"> 

       <RadioButton 
        android:id="@+id/radio_q5_1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="YES" /> 

       <RadioButton 
        android:id="@+id/radio_q5_2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="NO" /> 

       <RadioButton 
        android:id="@+id/radio_q5_3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="IN PROCESS" /> 

       <RadioButton 
        android:id="@+id/radio_q5_4" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="JUST GRADUATED" /> 

      </RadioGroup> 
     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="20dp"> 

      <Button 
       android:id="@+id/Previous2" 
       style="?attr/borderlessButtonStyle" 
       android:layout_width="100dp" 
       android:layout_height="50dp" 
       android:layout_alignParentLeft="true" 
       android:text="<<Previous" 
       android:textAllCaps="false" 
       android:textColor="#ffffff" /> 

      <Button 
       android:id="@+id/Next2" 
       style="?attr/borderlessButtonStyle" 
       android:layout_width="100dp" 
       android:layout_height="50dp" 
       android:layout_alignParentRight="true" 
       android:text="Next>>" 
       android:textAllCaps="false" 
       android:textColor="#ffffff" /> 
     </RelativeLayout> 


    </LinearLayout> 
</ScrollView> 

XMLファイル:

<RelativeLayout 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" 
android:background="@drawable/background111" 
tools:context=".Register_Page1"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:layout_gravity="center" 
    android:fillViewport="true" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:orientation="vertical" 
     android:paddingBottom="30dp" 
     android:paddingLeft="20dp" 
     android:paddingRight="20dp"> 

     <RelativeLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:id="@+id/t1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10dp" 
       android:gravity="center" 
       android:padding="5dp" 
       android:text="Elite English Club Entry Assessment Form" 
       android:textColor="@color/black" 
       android:textSize="38dp" 
       android:typeface="sans" /> 

      <TextView 
       android:id="@+id/t2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/t1" 
       android:gravity="center_horizontal" 
       android:text="This is our Form for students who are interested in joining our Elite English Club."></TextView> 
      > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/t2" 
       android:layout_gravity="left" 
       android:layout_marginTop="20dp" 
       android:text="* Required" 
       android:textColor="@color/Item_Red"></TextView>> 
     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/usernameWrapper" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="20dp"> 

       <EditText 
        android:id="@+id/Name" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="10dp" 
        android:ems="10" 
        android:hint="What's your name? *" 
        android:inputType="textPersonName" 
        android:textColorHighlight="#fff" /> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/englishlevelWrapper" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/usernameWrapper" 
       android:layout_marginTop="10dp"> 

       <EditText 
        android:id="@+id/English_Level" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_horizontal" 
        android:layout_marginTop="10dp" 
        android:ems="10" 
        android:hint="What is your english level? *" 
        android:inputType="textMultiLine" /> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/reasonsWrapper" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/englishlevelWrapper" 
       android:layout_marginTop="10dp"> 

       <EditText 
        android:id="@+id/Reasons" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_horizontal" 
        android:layout_marginTop="10dp" 
        android:ems="10" 
        android:hint="Reasons for improving your English*" 
        android:inputType="textMultiLine" /> 
      </android.support.design.widget.TextInputLayout> 


     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="20dp"> 


      <Button 
       android:id="@+id/Next1" 
       android:layout_width="100dp" 
       android:layout_height="50dp" 
       android:layout_alignParentRight="true" 
       style="?attr/borderlessButtonStyle" 
       android:textColor="#ffffff" 
       android:text="Next>>" 
       android:textAllCaps="false" /> 
     </RelativeLayout> 

    </LinearLayout> 

</ScrollView> 

+0

を試してみてください。その同等のUnicodeを使用します。 –

+1

'&gt'や何かのような、エンコードされたバージョンが必要だと思ってください。 –

+0

@Rotwang:使い方を教えていただけますか? –

答えて

1

は、あなたがシンボル `<` and `>を`使用することはできません。このコード

  <Button 
      android:id="@+id/Previous2" 
      style="?attr/borderlessButtonStyle" 
      android:layout_width="100dp" 
      android:layout_height="50dp" 
      android:layout_alignParentLeft="true" 
      android:text="&lt;&lt; Previous" 
      android:textAllCaps="false" 
      android:textColor="#ffffff" /> 

     <Button 
      android:id="@+id/next" 
      style="?attr/borderlessButtonStyle" 
      android:layout_width="100dp" 
      android:layout_height="50dp" 
      android:layout_alignParentLeft="true" 
      android:text="Next &gt;&gt;" 
      android:textAllCaps="false" 
      android:textColor="#ffffff" /> 
+0

ありがとう。それは働いた! –

+0

O c'mon、それは不公平です – xenteros

+2

@xenteros助けを求める吸血鬼は、彼らがコピー&ペーストできると思うことなく、あなたのせいではありません。 –

1

文字<>xmlファイルにエスケープする必要があります。

あなたは&gt;&#62;&lt;または&#60;><を逃れることができます。

+0

問題が解決するかどうか確認してください –

+0

問題を解決しましたか? – xenteros

+0

問題は "<<" and ">>"をテキストとして使用することです。そして、私はそれを "&lt"と "&gt"に置き換えます。このエラーは –

関連する問題