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
Which layout in Android arranges child views in a single row or column?
Answer: LinearLayout
LinearLayout arranges its child views sequentially in either a horizontal or vertical direction.
What attribute is used to make a view occupy remaining space in a LinearLayout?
Answer: layout_weight
The layout_weight attribute distributes remaining space proportionally among views in a LinearLayout.
Which view group is recommended for building flat, complex UI hierarchies in Android?
Answer: ConstraintLayout
ConstraintLayout allows you to create complex layouts with a flat view hierarchy, improving rendering performance.
What is the purpose of the ViewBinding feature in Android?
Answer: To generate binding classes for XML layouts eliminating findViewById
ViewBinding generates a binding class for each XML layout file, providing type-safe references to all views with an ID.
Which RecyclerView component is responsible for measuring and positioning item views?
Answer: LayoutManager
The LayoutManager in RecyclerView handles the layout strategy for its child views, such as linear, grid, or staggered arrangements.
What method must be overridden to provide views in a RecyclerView.Adapter?
Answer: onCreateViewHolder
onCreateViewHolder is called when the RecyclerView needs a new ViewHolder to represent an item, inflating the item layout.