How to comment my XML files in Android Studio

Issue

I am learning Android and want to be able to add line comments to my XML so I can remind myself what things are doing.

Is there an accepted practice for this, or is it possible in Android Studio? I recall reading that comments in XML are hard, so I wanted to know if that was also considered true here.

Solution

As mentioned above you can comment in XML just like this:

<!-- Comment -->

But in android studio you can very easily toggle comment just by selecting what you want to comment and then pressing:

CTRL + /

This not only for XML but also for your java code for example.

Answered By – Allinone51

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *