Android UI and Layouts Flashcards
6 cards from real Android Development practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Android UI and Layouts flashcards as text
What is the role of the merge tag in Android XML layouts?
Answer: To eliminate redundant view groups when including layouts
The tag helps reduce the depth of the view hierarchy by eliminating a redundant parent layout when using .
Which ConstraintLayout feature allows multiple views to be evenly spaced using a chain?
Answer: Chain style
Chains in ConstraintLayout allow you to control how a group of views distribute space and position relative to each other.
What is a ViewHolder pattern used for in Android?
Answer: To cache view references and avoid repeated calls to findViewById
The ViewHolder pattern stores references to views within a list item, eliminating the costly lookup via findViewById on every scroll.
Which XML attribute sets a fixed aspect ratio for a view in ConstraintLayout?
Answer: app:layout_constraintDimensionRatio
app:layout_constraintDimensionRatio constrains one dimension of a view relative to the other based on a specified ratio.
What method inflates a layout resource in Android?
Answer: Both A and B
Both LayoutInflater.inflate() and View.inflate() can be used to instantiate a layout XML file into its corresponding View objects.
Which attribute in RecyclerView sets the orientation for LinearLayoutManager?
Answer: app:layoutManager with orientation parameter
You configure LinearLayoutManager with HORIZONTAL or VERTICAL orientation either in code or via XML with app:layoutManager.