Android: drawable resource with numbers. Is it possible?

大城市里の小女人 提交于 2019-12-01 16:19:35

问题


I would like to know if i can, somehow, create a drawable resource (png for example) called 787.png. Because Eclipse wont let me compile the project unless i modify it.

Thanks in advance.


回答1:


The reason you can't have a resource with a numeric name is because variable names cannot start with numbers. For each resource, there is a generated constant variable (in R.java) with the resource's name. If you look in your Eclipse project, under the "gen" folder you will see R.java

It is my understanding that it is not possible to have a resource with a pure numeric name in an android project.

If you explain why you require a numeric resource, maybe we can provide alternative solutions



来源:https://stackoverflow.com/questions/7096892/android-drawable-resource-with-numbers-is-it-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!