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 class is used to implement custom drawing on a Canvas in Android?
Answer: Custom View extending View
You create a custom view by extending the View class and overriding the onDraw(Canvas) method to perform custom drawing.
Which attribute controls the visibility of a view in Android XML?
Answer: android:visibility
The android:visibility attribute accepts VISIBLE, INVISIBLE, or GONE to control whether a view is shown or takes up space.
What is the purpose of the include tag in Android XML layouts?
Answer: To reuse a layout file inside another layout
The tag allows you to embed another layout XML file inside the current layout, promoting reusability.
Which method is called when the size of a view changes?
Answer: onSizeChanged
onSizeChanged is called when the size of a view changes, providing the new width, height, and old values.
What does the dp unit represent in Android?
Answer: Density-independent pixels
dp (density-independent pixels) is a virtual unit that scales based on screen density to ensure consistent physical size across devices.
Which component in Material Design is used to display brief, non-disruptive messages at the bottom of the screen?
Answer: Snackbar
Snackbar provides brief feedback about an operation at the bottom of the screen and can include an optional action.