Home > database >  Android Studio xml layout files not recognized as layout file
Android Studio xml layout files not recognized as layout file

Time:07-29

I've been encountering some very odd problems with Android Studio today.

When I open an XML layout file, it opens as a plain text for some reason. It even says that I have a typo for constraintLayout and tells me to change it to constraint's layout.

There's no design view choice in sight.

I tried adding elements by hand in the XML file but, when I type in Text usually the TextView property should appear for me to choose. However, that doesn't show up lol.

I tried invalidating caches, rebuilding my project, cleaning my project, restarting my laptop, and this method: enter image description here

What the icon looks like: enter image description here

I also tried just adding things to my XML by hand and running it on my device. The thing does run, and my textView shows up on my screen, but when I try to use findViewById to find it in my activity file, it can't find the id.

CodePudding user response:

Right click on activity_login.xml file from Project/android view structure and select Mark as XML . Somehow this file marked as text file from your IDE.

  • Related