Over 10 years we helping companies reach their financial and branding goals. Onum is a values-driven SEO agency dedicated.

CONTACTS
ECET 2026 CSE

Day 46 – Night Session: Android – Views, Widgets & XML Layout – ECET 2026

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:
    1. LinearLayout → Arranges views vertically/horizontally.
    2. RelativeLayout → Positions views relative to each other.
    3. ConstraintLayout → Modern, flexible, recommended.
    4. 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:

 dp = \dfrac{px \times 160}{dpi}

Where:

  •  px = pixels
  •  dpi = screen density

📐 Example

  • Screen density =  320 ; dpi
  • UI element =  200 ; px

 dp = \dfrac{200 \times 160}{320} = 100 ; dp


🔟 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)  dp = \dfrac{px \times dpi}{160}
B)  dp = \dfrac{px \times 160}{dpi}
C)  dp = \dfrac{px}{160}
D)  dp = \dfrac{dpi}{px}

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.NoAnswer
Q1B
Q2B
Q3B
Q4B
Q5C
Q6B
Q7B
Q8A
Q9B
Q10D

🧠 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 holds RadioButtons.
  • 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.

📲 Join Our ECET Prep Community on WhatsApp

👉 Join WhatsApp Group – Click Here

Leave a comment

Your email address will not be published. Required fields are marked *