AND-801 practice question 5 of 10

Fill in the blank space in the following sentence with the correct choice: The..................... to arranges widgets in positions relative each other.

Full set: 45 questions
Answer options
A: RelativeLayout Correct answer
B: Table Layout
C: Linear Layout
D: ConstraintLayout
Correct Answer:
A. RelativeLayout
Explanation

RelativeLayout is a ViewGroup subclass used to specify the position of child View objects relative to each other or to the parent ViewGroup. It allows for complex layouts without nesting multiple LinearLayout groups. For example, a widget can be positioned "below" or "to the right of" another widget, or "aligned to the parent's bottom edge." While ConstraintLayout is a more modern and flexible alternative, RelativeLayout is the classic layout whose primary definition is arranging widgets in positions relative to each other.

Why Incorrect

B. TableLayout: This layout arranges child views into a grid of rows and columns, not based on their relative positions to one another.
C. LinearLayout: This layout arranges child views in a single direction, either vertically or horizontally, in a sequential order.
D. ConstraintLayout: While it also positions views relative to others, it does so using a system of "constraints." RelativeLayout is the specific layout whose name and fundamental concept directly match the question's phrasing.

References

1. Official Android Developer Documentation, "RelativeLayout": "RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left, or center)."

Source: https://developer.android.com/guide/topics/ui/layout/relative-layout

2. Purdue University, CS 390-17 Courseware, "Lecture 06: UI Layouts": In the section describing RelativeLayout, the document states, "Allows you to specify the location of child objects relative to each other or to the parent."

Source: Page 20, https://www.cs.purdue.edu/homes/bxd/390-17/lects/06-UI-Layouts.pdf

3. Official Android Developer Documentation, "Build a Responsive UI with ConstraintLayout": "It's similar to RelativeLayout in that all views are laid out according to relationships between sibling views and the parent layout, but it's more flexible and easier to use with Android Studio's Layout Editor." This reference confirms the fundamental principle of RelativeLayout while introducing its successor.

Source: https://developer.android.com/training/constraint-layout, Introduction section, Paragraph 1.

Scroll to Top