0

我正在编写一个应用程序,它将一系列控件存储在数据库中,以便在运行时在屏幕上绘制。我想将数据库 ID 分配为控件 ID,以便更轻松地将任何给定控件链接到其数据库记录。控件 ID 是否需要在其直接父级之外是唯一的?

4

1 回答 1

0

看起来我能够回答我自己的问题。android.View 状态的参考文档:View IDs need not be unique throughout the tree, but it is good practice to ensure that they are at least unique within the part of the tree you are searching. 从中我确定它们不需要是唯一的。您可能会认为 google 会在心跳中给出这个答案,但几乎所有关于 View 或 Control ID 的在线参考都谈到了 XML 属性。

于 2012-04-18T13:04:37.140 回答