Views, layouts og fragments Flashcards
Views and layouts (63 cards)
What are the interface elements available in Android SDK?
Display information, gather information, listen for user actions, style controls, apply themes to the entire screen.
What is the Android View class?
It is a basic user interface building block in the package android.view that represents a rectangular portion of the screen.
What is a ViewGroup?
A ViewGroup contains nested views, such as layouts.
What does the package android.widget contain?
It contains mostly visual UI elements (controls) to use on your application screen.
How do you access a UI element in Java?
Use the method findViewById(…) in the Activity class and typecast to the appropriate element.
What is a layout in Android?
A layout controls a View object and is a container for other controls (children).
What is a TextView?
A TextView is primarily used to display fixed text strings or labels and inherits attributes from View.
What are common TextView attributes?
Width, height, padding, and visibility. Recommended to use ‘ems’ for width and ‘lines’ for height.
What does the autoLink attribute do?
It enables linking of text referring to email addresses, web pages, phone numbers, and street addresses.
How do you define an EditText?
An EditText is essentially an editable TextView with an android:hint attribute.
What are input filters in EditText?
Input filters constrain user input, and predefined filters are available in the Android SDK.
What is AutoCompleteTextView?
It fills in text entries based on user input, showing a developer-provided list that matches.
What is a Spinner control?
A Spinner limits the choices available for users to type and is a list of TextView objects.
What is a Toast in Android?
A Toast is a view containing a quick message for the user, shown for a short period.
How do you handle click events?
Define a class that implements the interface View.OnClickListener.
What is an ImageButton?
An ImageButton uses an image instead of text as a label.
What is a CheckBox?
A CheckBox allows users to select multiple items and shows its state as checked or unchecked.
What is a ToggleButton?
A ToggleButton shows or alters the on or off state of something and has two text fields.
What does a Switch control look like?
A Switch looks like a slider and can be used to toggle between on and off states.
What is a RadioGroup?
A RadioGroup allows users to select only one RadioButton from a group.
How do you get dates and times in Android?
Use DatePicker and TimePicker classes, implementing their respective change listeners.
What is a ProgressBar?
A ProgressBar indicates progress when actions take a while, with various styles available.
What is a SeekBar?
A SeekBar allows users to move an indicator to change the current position in a media file.
What is a RatingBar?
A RatingBar shows or gets a rating from a user.