Naming rules for Android resources

后端 未结 6 1277
萌比男神i
萌比男神i 2020-12-10 07:29

where can I find the naming rules for Android resources? I found out thanks to compilation errors that I must use characters within [a-z0-9._], but I also have an error with

相关标签:
6条回答
  • 2020-12-10 07:36

    Your convention is correct, except that you can't start your file names with a number.

    0 讨论(0)
  • 2020-12-10 07:43

    Naming rules for resources are the same as for the variables, except the case-sensitivity. In your case, problem is the first character is number.

    0 讨论(0)
  • 2020-12-10 07:47

    The rules are the same as for Java identifiers since each resource must have a corresponding ID field generated in the R.java file.

    0 讨论(0)
  • 2020-12-10 07:49

    This is Java rule, not Android-only rule. Name each element with a starting letter, and you'll be right.

    0 讨论(0)
  • 2020-12-10 07:59

    Worth noting that: "File-based resource names must contain only lowercase a-z, 0-9, or underscore" characters. (quoted from compile error code).

    0 讨论(0)
  • 2020-12-10 07:59

    The number is not allowed as first char of resource also not any capital letter

    0 讨论(0)
提交回复
热议问题