Module 5 Flashcards
These define the structure for a user interface in your app, such as in an activity.
Layouts
True or False.
All elements in layouts are built using a hierarchy of View objects.
False.
(built using a hierarchy of View and ViewGroup objects)
This usually draws something the user can see and interact with.
View
This is a/an invisible container that defines the layout structure for View and other ViewGroup objects.
ViewGroup
True or False.
Each layout file must contain only one root element, which must be a View or a ViewGroup object.
True
True or False.
Once you’ve defined the root element, you can no longer add additional layout objects or widgets as child elements to gradually build a View hierarchy that defines your layout.
False.
(you CAN add additional layout objects)
View objects are also known as “____”.
Widgets
ViewGroup objects are also known as “______”.
Layouts
What are the two ways that View and ViewGroup can be declared?
- Declare UI Elements in XML
- Instantiate Layout Elements at Runtime
A unique resource name for the element, which you can use to obtain a reference to the View or ViewGroup from your application.
Resource ID
What is the correct syntax for referencing an Android resource ID?
android:id=”@id/resource_id”
Assume that you have defined a button in your XML file with the id, “clicker”.
What is the proper syntax for creating an instance of the view object and capture it from the layout?
Button varName = (Button) findViewById(R.id.clicker)
What are the different layout types?
- Linear Layout
- Relative Layout
- Frame Layout
- Table Layout
- Web View
- List View
- Grid View
It is a ViewGroup subclass which is used to render all child View instances one by one either in Horizontal direction or Vertical direction based on the orientation property.
Linear Layout
In android, we can specify the linear layout orientation using ____________ attribute.
android:orientation
It is a ViewGroup which is used to specify the position of child View instances relative to each other (Child A to the left of Child B) or relative to the parent (Aligned to the top of parent).
Relative Layout
It is very useful to design user interface using this layout because we can eliminate the nested view groups and keep our layout hierarchy flat, which improves performance of application.
Relative Layout
It is a ViewGroup subclass which is used to specify the position of View instances it contains on the top of each other to display only single View inside the layout.
Frame Layout
In simple manner, we can say _________ is designed to block out an area on the screen to display a single item.
Frame Layout
In this layout, the child views are added in a stack and the most recently added child will show on the top.
Frame Layout
We can add multiple children views to FrameLayout and control their position by using _______ attributes in FrameLayout.
gravity