How to comment in XML file in ANDROID STUDIO

Hey guys,
If you are searching for how to comment in an XML file in the android studio then you are in right place.

THE SYNTAX OF COMMENTING IN XML

<!--HERE YOU CAN WRITE WHAT TO WANT -->
Let take an example using the comment in XML

You should write the tag outside the XML tag:
<RelativeLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content">

       <!--This is relative layout. -->

       <TextView
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
       />
    </RelativeLayout>
WARNING OR POINT TO REMEMBER

You should not write comment inside the tag in XML:

<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   <!--donot use comment inside the layout -->
/>






Post a Comment

0 Comments