I have a bunch of View
s in a <merge>
, and I included that <merge>
into a RelativeLayout
. I try to refer to the IDs of those included View
s to act as anchors for my other View
s, but Eclipse complains that the IDs are not resolving. I found a workaround by using @+id
rather than @id
when I first refer to them rather than when I actually define the objects they refer to. I've already defined the two ID
s in a Style
and in the included <merge>
where they are declared, so it feels a bit inefficient if I keep repeating the definition of the ID.
Is this the correct way of doing it? I'm assuming it's bad cause the '+' is another initialization. My current hypothesis is that you should use @+id
when you first use the ID rather than when you initialize the object that the ID is going to represent, a bit like C/C++
and how they require at least a function prototype in the lines prior to the actual code that uses the function.
Another question I have is when you use the GUI-based UI builder of Eclipse, I noticed that they always use @+id
rather than @id
. Is this acceptable, cause it seems inefficient to me; it's as if the application will be spending more time determining whether or not the ID has been declared in R.id
.