Capital Idea…Or Not 53/100 Days of Code
So Android Studio has an issue with capital letters…now I know
I haven’t written xml code in a while, but today I created a styling the layout for the Travel app by hand. And NO I didn’t use autocomplete. All the bragging rights, none of the rework.
Anyway, I created my file by right clicking the layouts folder and adding a file called layout_Dialog_Box.xml. I added the XML attributes, but I kept seeing a red squiggly under the opening tag of the file
I managed to fix it, but it was the strangest issue I’ve ever seen. You can find a video at the bottom of the page and a link to the source code here.
I followed my usual steps, but for some reason, I was seeing this error. What’s more, I couldn’t use this layout to inflate a view in the class file for the Dialog.
The layout didn’t even appear under the list of layouts! This was peculiar indeed. So I tried something different. I added a new XML layout file by selecting XML in the New File menu.
I tried to type the filename layout_DialogBox when I got this warning:
Android Studio doesn’t seem fond of capital letters in layout filenames. And that’s fine! At least I know for next time. Now I see why Android Studio saves new layouts with lowercase letters in the filename by default. For more on this, watch the YouTube video below. For the source code click here
Join the mailing list to see updates like this every week!
Coding Fanatic
Image by Mahesh Patel from Pixabay