我正在编写一个应用程序,它将一系列控件存储在数据库中,以便在运行时在屏幕上绘制。我想将数据库ID分配为控件ID,以便更容易将任何给定控件链接到其数据库记录。控制ID是否需要在其直接父母之外是唯一的?
答案 0 :(得分: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属性。