
In ECET 2026 CSE, Android development basics are important. Questions often come from Views, Widgets, and XML Layout concepts. Understanding these helps students crack mobile application–related questions easily.
📘 Concept Notes
🌐 What is a View?
- A View is the basic building block of UI in Android.
- Anything you see on the screen (button, text, image, etc.) is a View.
- Examples:
TextView
,Button
,ImageView
,EditText
.
🧩 What are Widgets?
- Widgets are ready-made UI components (specialized Views).
- They provide interactivity.
- Examples:
Button
→ clickable action.CheckBox
→ select multiple options.RadioButton
→ select one from many.ProgressBar
→ show loading.Switch
→ ON/OFF toggle.
📝 What is XML Layout?
- Layouts in Android are designed using XML (Extensible Markup Language).
- XML describes how UI elements (Views & Widgets) are arranged.
- Example:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello ECET 2026!" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />
</LinearLayout>
⚙️ Important Points
- Layout Types:
- LinearLayout → Arranges views vertically/horizontally.
- RelativeLayout → Positions views relative to each other.
- ConstraintLayout → Modern, flexible, recommended.
- FrameLayout → Stacks views on top of each other.
- View Properties (Common XML attributes):
android:id
→ Unique ID.android:layout_width
→ Size (match_parent / wrap_content).android:layout_height
→ Height.android:text
→ Display text.
🔋 Formula (for layout size calculations)
When designing layouts, size adjustments often use density-independent pixels (dp).
Relationship between pixels (px) and dp:
Where:
= pixels
= screen density
📐 Example
- Screen density =
- UI element =
🔟 10 Expected MCQs – ECET 2026
Q1. In Android, the base class for all UI components is:
A) Widget
B) View
C) Layout
D) Activity
Q2. Which XML attribute is used to set the text of a TextView
?
A) android:caption
B) android:text
C) android:value
D) android:label
Q3. Which layout arranges elements either vertically or horizontally?
A) FrameLayout
B) LinearLayout
C) RelativeLayout
D) TableLayout
Q4. Default unit used in Android XML layouts is:
A) px
B) dp
C) pt
D) mm
Q5. A group of radio buttons is enclosed inside:
A) LinearLayout
B) RelativeLayout
C) RadioGroup
D) CheckBoxGroup
Q6. Which widget is used for ON/OFF toggle?
A) CheckBox
B) Switch
C) RadioButton
D) Spinner
Q7. The formula to convert px → dp is:
A)
B)
C)
D)
Q8. In ConstraintLayout, constraints are applied:
A) Relative to parent and siblings
B) Only vertical
C) Only horizontal
D) Not possible
Q9. The unique identifier for a View is set using:
A) android:ref
B) android:id
C) android:name
D) android:tag
Q10. Which of the following is NOT a widget?
A) Button
B) TextView
C) ProgressBar
D) Intent
✅ Answer Key
Q.No | Answer |
---|---|
Q1 | B |
Q2 | B |
Q3 | B |
Q4 | B |
Q5 | C |
Q6 | B |
Q7 | B |
Q8 | A |
Q9 | B |
Q10 | D |
🧠 Explanations
- Q1 → B: All UI elements derive from
View
. - Q2 → B:
android:text
sets text. - Q3 → B: LinearLayout arranges vertically/horizontally.
- Q4 → B: dp is default unit.
- Q5 → C:
RadioGroup
holdsRadioButton
s. - Q6 → B:
Switch
is for toggle. - Q7 → B: Correct formula.
- Q8 → A: ConstraintLayout supports relative positioning.
- Q9 → B:
android:id
sets unique ID. - Q10 → D: Intent is a component, not a widget.
🎯 Why Practice Matters
- Android UI design is repeatedly asked in ECET exams.
- Questions are direct, focusing on Views, Widgets, XML properties, and simple formulas (dp ↔ px).
- Mastering these ensures 2–3 sure-shot marks in the Mobile Computing / Android section.