Android Studio not identifying xml file as layout file Android Studio not identifying xml file as layout file xml xml

Android Studio not identifying xml file as layout file


Found the source of the problem - it was in the config files Android Studio creates in your home directory: ~/.AndroidStudioPreview2.0. In my case, it was ~/.AndroidStudioPreview2.0/config/options/filetypes.xml

    <application>      <component name="FileTypeManager" version="16">        <ignoreFiles list="*.hprof;*.pyc;*.pyo;*.rbc;*~;.DS_Store;.git;.hg;.svn;CVS;RCS;SCCS;__pycache__;_svn;rcs;" />        <extensionMap>          <mapping pattern="drawer_list_item.xml" type="PLAIN_TEXT" />        </extensionMap>      </component>    </application>

Therefore, it seems like I somehow made Android Studio index that file name pattern drawer_list_item.xml as plain text...Removing that mapping entry from the file solves the problem: <mapping pattern="drawer_list_item.xml" type="PLAIN_TEXT" />


Preferences -> File Types and remove the Registered PatternAndroid Studio Preferences


I simply had to right click on the file in the Project view and select 'Mark as XML' in Android Studio 2.2.x

enter image description here