在Android的保留字列表 [英] List of reserved words in Android

查看:172
本文介绍了在Android的保留字列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前是在开发另一个Android应用程序的界面设计过程,我再一次似乎试图将保留字的资源(无论是可绘和布局)。据我所知,有一组规则,你需要知道的:

  • 在没有大写是允许的。
  • 无符号除了下划线。
  • <打击>无号

Appart酒店从这些(请纠正我,如果我错了)我的认为的,你不能使用任何的储库的话从Java这一点谷歌搜索后,出现如下所示:

所以我的问题是,如果出现在某个地方,我已经无法找到文档,即详细解释了我们可以和不会使用资源名称。这之后读取页面有关资源,它可能是我只是在读一文不值。

来源为保留字

解决方案
  

据我所知,有一组规则,你需要知道的:

     

没有大写是允许的。

AFAIK,这不是一个规则。按照惯例全部使用小写,但混合的情况下工作过。

注意:在布局中,你可以只使用小写字母(AZ),数字(0-9)和下划线(_)

  

没有符号,除了下划线

正确的。更准确地说,这个名字必须是一个有效的Java数据成员的名字,这限制了你的字母,数字和下划线,并且不能以数字开头。

  

没有数

这不是一个规则,但你的名字不能以数字开头,如上所述。

  

Appart酒店从这些(请纠正我,如果我错了),我认为你不能使用任何的储库的话从Java这一点谷歌搜索后,出现如下所示:

这是因为保留字是无效的Java数据成员的名字。

  

所以我的问题是,如果出现在某个地方,我已经无法找到文档,解释详细,我们可以和不可以使用什么资源名称

显然不是。

I'm currently in the interface design process of developing another Android app and once again I seem to be trying to use reserved words for the resources (be it drawables and layouts). To my knowledge there are a set of rules you need to know:

  • No uppercase is allowed.
  • No symbols apart from underscore.
  • No numbers

Appart from those (please correct me if I'm wrong) I think you can't use any of the reserver words from JAVA which after a little googling appear to be the following:

So my question would be if there is somewhere in the docs that I've failed to locate, that explains in detail what we can and can not use for resource names. This is right after reading the page about resources so its possible that I'm simply worthless in reading.

Source for the reserved words

解决方案

To my knowledge there are a set of rules you need to know:

No uppercase is allowed.

AFAIK, that is not a rule. A convention is to use all lowercase, but mixed case has worked.

NOTE: In layouts you can ONLY use lowercase letters (a-z), numbers (0-9) and underscore (_).

No symbols apart from underscore

Correct. More accurately, the name has to be a valid Java data member name, which limits you to letters, numbers, and underscores, and it cannot start with a number.

No numbers

That is not a rule, though your name cannot start with a number, as noted above.

Appart from those (please correct me if I'm wrong) I think you can't use any of the reserver words from JAVA which after a little googling appear to be the following:

That is because reserved words are not valid Java data member names.

So my question would be if there is somewhere in the docs that I've failed to locate, that explains in detail what we can and can not use for resource names

Apparently not.

这篇关于在Android的保留字列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆