Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android layouts start with <?xml version... ?> [duplicate]

Tags:

android

I'm a beginner in App development for Android. My question is pretty simple. I can't seem to find out if the xml files in the layout folder should start with:

<?xml version="1.0" encoding="utf-8"?>

When i made a starter project, it wasn't there. But I'm also reading a book which says it should be there?

What is the correct way?

like image 805
Haagenti Avatar asked Aug 21 '13 09:08

Haagenti


1 Answers

Well this declaration should not be tagged with android but it is rather an xml syntax. It defines the XML version (1.0) and the encoding used (utf-8 = (8-bit Unicode Transformation Format)).

XML documents can contain non ASCII characters, like Norwegian æ ø å , or French ê è é.

To avoid errors,the XML encoding is specified,and files are saved Unicode.

These are some other examples of xml headers, that you can experiment with or study about :

<?xml version="1.0" encoding="us-ascii"?>
<?xml version="1.0" encoding="windows-1252"?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-16"?>
like image 135
Prateek Avatar answered Nov 15 '22 20:11

Prateek