0

So I want to tell myself some things withing the .xml file using Pseudo code but when I do the // it enters it like a code so I can't really use it in there. Is there something I could do to make the code non readable like Pseudo Code? I'm doing this in an android application. Under the res/layout/(.xml file) folder. Thanks!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Fernando
  • 450
  • 1
  • 7
  • 22

2 Answers2

3

The comment in XML are like this

<!-- this is a comment -->

Notice that they can span on multiple lines

<!--
    This is a comment
    on multiple lines
-->

But they cannot be nested

<!-- This <!-- is a comment --> This is not -->

Also you cannot use them inside tags

<EditText <!--This is not valid--> android:layout_width="fill_parent" />
K_Anas
  • 31,226
  • 9
  • 68
  • 81
  • I tried that but then it like hides it from the android:id to all the way down I just want to use the code on the android:textSize line android:id="@+id/tvResults" android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content" /> – Fernando May 31 '12 at 02:00
  • @FernandoRamirez You cannot use them inside a tag, as the answer states. – Dave Newton May 31 '12 at 02:04
  • @FernandoRamirez as i said you cannot use them inside a tag, if you want to comment an attribute in a widget tag you bring out of the tag and then comment it – K_Anas May 31 '12 at 02:08
0

Comments in HTML & XML are like so:

<!-- this is a comment -->

See On SGML and HTML: Comments for more details.


Suggestion:

<!-- textSize: For the 'hearing impaired'. --> 
<TextView 
    android:text="invalid" 
    android:textSize="25dp" 
    android:id="@+id/tvResults" 
    android:gravity="center" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433