@+id/和android:id有什么区别?

论坛 期权论坛 脚本     
匿名网站用户   2020-12-20 08:33   90   0

android:id和@id一样是引用已有的id,

@+id是新增加一个id

在Dev Guide -> User interface -> Declaring Layout 里面看到的。
The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource. The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R.java file). There are a number of other ID resources that are offered by the Android framework. When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace, like so:
android:id="@android:id/empty"

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:1136255
帖子:227251
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP