Issue
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: Android Studio not identifying xml file as layout file but they all don't work for some reason.
Usually my layout files should have a small icon thing in the file structure thing but that also doesn't show up.
Thanks so much.
Edit: here's what it looks like in my XML file
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.
Solution
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.
Answered By - Zahid Islam
Answer Checked By - Candace Johnson (JavaFixing Volunteer)