Order Of Evaluation With Relative Layouts, Best Practices And Parsing Of Relative-layout
Solution 1:
@+id/name
creates a new id, if it doesn't already exist. @id/name
references an existing id, and will never create one.
I'm not sure if you can use @id/name
before @+id/name
in the same file. If not, I can think of two workarounds:
Always use
@+id/name
.Define all id's in the
ids.xml
file, and always use@id/name
.
Solution 2:
This is general information on how Android draw views. I think that Android passes twice through all the view, but it doesn't pass through each single view once. So if you have a reference from one xml to another it will always work fine, but if you have references inside a single xml you must be carefull to order the elements in the xml correctly. For example, I have view1 and view2 in my RelativeLayout. If I want to refer to view2 from view1 I must declare view2 before view1.
Post a Comment for "Order Of Evaluation With Relative Layouts, Best Practices And Parsing Of Relative-layout"