为什么不能文件名的文件夹绘制包含特殊字符或以大写字母? [英] Why can't file names in the drawable folder contain special characters or start with a capital letter?
问题描述
有没有点这些规则?
推荐答案
文件夹内的每个文件被翻译成R.java类中的Java字段名:
Each file inside folder is translated into java field name inside R.java class:
drawable\icon.png -> R.drawable.icon
因此,为何不使用文件名里的特殊字符,因为它们无法在Java名称中使用。
Hence the reason for not using special characters inside file names, as they can no be used in Java names.
至于大写字母,我想这是为了避免一个小问题在Windows与Linux环境。这是因为Linux认为的icon.png
和的icon.png
是不同的文件,Windows认为的icon.png
和的icon.png
是同一个文件。因此,使用Linux可以创建应用程序,未在Windows编译任何人。
As for capital letters, I guess that's to avoid one little problem in Windows vs. Linux environment. That's because Linux thinks that Icon.png
and icon.png
are different files, and Windows thinks that Icon.png
and icon.png
is the same file. So anyone using Linux can create application that is not compilable on Windows.
这篇关于为什么不能文件名的文件夹绘制包含特殊字符或以大写字母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!