What is the diffirence between the
@id/
and@+id/
?
In @+id/
the plus symbol
Difference between @+id
and @id
is:
@+id
is used to create an id for a view in R.java
file.@id
is used to refer the id created for the view in R.java file.We use @+id
with android:id=""
, but what if the id is not created and we are referring it before getting created(Forward Referencing).
In that case, we have use @+id
to create id and while defining the view we have to refer it.
Please refer the below code:
In the above code,id for Spinner @+id/spinner
is created in other view and while defining the spinner we are referring the id created above.
So, we have to create the id if we are using the view before the view has been created.