Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio : How to add end/closing tag automatically in layout xml file

Where can I find the setting for automatically adding the closing tag in layout XML in Android Studio? For example, if I select TextView from suggestions, it should automatically close it with /> .

enter image description here

I used to get the ending tag automatically, but after updating Android Studio, I am not getting it anymore. I tried searching in Editor > Code Style > XML, but didn't find any relevant setting.

enter image description here

I am on Android Studio 3.5 RC 3.

like image 696
Manohar Avatar asked Aug 01 '19 09:08

Manohar


People also ask

Is closing tag mandatory in XML?

All XML elements must have a closing tag It is illegal to omit the closing tag when you are creating XML syntax. XML elements must have a closing tag.

What is a self-closing tag in XML?

In XML and XHTML, a self-closing tag is a shorthand notation for an opening and closing tag in one. It's used to communicate lack of content in between the opening and closing tags. So, rather than typing <p></p> (with no space at all in between), you'd be able write <p/> .

Which XML attribute can be used to put a view in front of other views?

bringToFront()” method will let you a perfect indicator view :) Also, there is another option to use a parent-children relationship views.


2 Answers

Could it be this one?

Android Studio Settings

Insert closing tag on tag completion and Auto-close tag on typing </ ?

For what is worth, mine closes automatically.

like image 200
Martin Marconcini Avatar answered Sep 29 '22 01:09

Martin Marconcini


I've both AD 3.4.2 and 3.5 RC 3 installed on my system. XML issues like this are only happening on 3.5+ versions. I've looked up at open issues and came to know that 3.5 causing many issues like No auto tags after completion, hangs/freezes during autocompletion and many more.

like image 25
Ali Ahsan Avatar answered Sep 29 '22 03:09

Ali Ahsan