Android Application Development (AND-401) — Question 52
Which of the following is correct about XML layout files?
Answer options
- A. In order to display a UI defined in the XML layout file "main.xml", call the setContentView method of the Activity with the parameter string "main.xml".
- B. There is no distinction between implementation of the layout definition by code, or by XML layout file.
- C. In an Eclipse project using the ADT plugin, the XML layout file is found in the /res/layout directory.
- D. Layout information written in the XML layout file will be converted into code by the Android platform when the screen is displayed.
Correct answer: C
Explanation
Option C is correct because, in an Eclipse project with the ADT plugin, XML layout files are indeed located in the /res/layout directory. Option A is incorrect as setContentView requires a resource ID, not a string. Option B is misleading since there are differences between defining layouts in code and XML. Option D is also inaccurate because the layout is not converted into code but rather interpreted at runtime.