代码改变世界

随笔档案-2012年11月

Android 不同View ID相同

2012-11-21 11:12 by JailBreak02, 396 阅读, 收藏,
摘要: 今天在写一段代码时,两个Activity的Button设置了相同的ID,竟然没有报错。然后查看R.java文件,发现class id中也只生成了一个Button变量,且分别在两个Activity中进行访问时均可达到预期效果,觉得奇怪。一,查阅google帮助文档,现引用如下:IDsViews may have an integer id associated with them. These ids are typically assigned in the layout XML files, and are used to find specific views within the vie 阅读全文