NEW
Font size
WorksheetsAndroid UI Elements Quiz
Total questions: 20
Worksheet time: 15mins
In Android, every user interface element is considered a:
Activity
View
Layout
Fragment
Which of the following is NOT an example of a View?
TextView
Button
LinearLayout
ImageView
Views can have the following properties EXCEPT:
Color and dimensions
Can have focus
Can be visible or invisible
Can run background services
Which XML attribute sets the width of a View to fill the parent container?
wrap_content
fill_parent
match_parent
expand_parent
In Android, a ViewGroup is best described as:
A collection of Activities
A type of View that contains other Views
A storage container for Java classes
A tool for debugging
Which layout arranges Views in either a row or column?
ConstraintLayout
RelativeLayout
LinearLayout
FrameLayout
Which layout is best for arranging child Views in rows and columns?
TableLayout
FrameLayout
GridView
RelativeLayout
The correct Java code to create a new TextView in an Activity is:
TextView myText = new TextView(this);
TextView myText = new TextView(context);
TextView myText = new TextView(new View());
TextView myText = new TextView();
Which measurement unit is recommended for text size in Android?
px
sp
dp
pt
The method used to capture a button click in Java is:
setOnClickHandler()
setOnAction()
setOnClickListener()
onTouchEvent()
In Android XML, how is a string resource referenced?
@res/string/title
@string/title
@text/title
R.string.title
Which layout shows only one child at a time in a stack?
FrameLayout
LinearLayout
GridView
RelativeLayout
The Toast class in Android is used for:
Logging messages
Showing popup notifications
Debugging applications
Running background services
Which class is the base class for all layouts in Android?
ViewGroup
ConstraintLayout
Activity
FrameLayout
In Java code, which class is used to set width and height for a View?
View.LayoutManager
LayoutInflater
LinearLayout.LayoutParams
ViewSettings
Which hierarchy is based on inheritance (e.g., Button → TextView → View)?
Layout hierarchy
View class hierarchy
Activity hierarchy
Resource hierarchy
Which hierarchy defines how Views are visually arranged?
Layout hierarchy
View class hierarchy
Context hierarchy
Resource hierarchy
What is the purpose of findViewById() in Android development?
To locate Activities
To create a new layout
To find a View by its XML ID
To log messages
Which log method in Android is used for error messages?
Log.w()
Log.d()
Log.e()
Log.i()
Which of the following should NOT be used for screen measurements in Android?
dp
sp
px
in
