Home > Mobile > Questions about the include other layout in XML
Questions about the include other layout in XML
Time:09-24
I found the referenced control the layout of the id and the original layout id cannot be consistent, otherwise the back doesn't work, For example, I in the main XML cited The android: id="@ + id/l2" Android: layout_width="wrap_content" Android: layout_height="wrap_content" Android: layout_marginTop="45 dp" Layout="@ layout/ano"/& gt; In ano. There is for the XML, and my main. XML has for the inside, only the front for the work, later use an item, so if you want to reference other layout, not to put other layout look again, see if there are any conflict of id? If the project reference layout more, it's too easy to conflict
CodePudding user response:
1. Different layout controls id should be well yourself to distinguish 2. View. The findViewById () should be able to solve
CodePudding user response:
Id don't repeat! Don't repeat! Don't repeat! Why the writing the same? Very easy to make a mistake to confuse, looking for a particular trouble, A new version of Android if repeat will be an error in the Studio,