0% found this document useful (0 votes)
5 views7 pages

MAD Answer

The document provides an overview of the Android ecosystem, tools for application development, and various UI components such as EditText and RadioButton, detailing their attributes with examples. It also includes a design for an employee registration form and explains the use of LinearLayout and FrameLayout in Android application design. Overall, it serves as a guide for understanding Android development fundamentals and UI design principles.

Uploaded by

bankheleom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

MAD Answer

The document provides an overview of the Android ecosystem, tools for application development, and various UI components such as EditText and RadioButton, detailing their attributes with examples. It also includes a design for an employee registration form and explains the use of LinearLayout and FrameLayout in Android application design. Overall, it serves as a guide for understanding Android development fundamentals and UI design principles.

Uploaded by

bankheleom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

a. State android ECO system.

( 2 Mks)

Ans. Android Ecosystem is a combination of Hardware, Software, Services and security working
together to form a Android OS.

b. List various tools for android application development. ( 2 Mks)

Ans.

• Android Studio
• Android SDK
• Java Development Kit
• Gradle
• Emulator
• Postman
• Eclipse

c. List various layouts used in android UI design. ( 2 Mks)

Ans.

• LinearLayout
• AbsoluteLayout
• RelativeLayout
• FrameLayout
• TableLayout

d. Explain any four attributes of Edit Text control with example. ( 4 Mks)

Ans. EditText in Android:

EditText is a UI component in Android that allows users to enter and modify text.

• Attributes of EditText:
1. android:id –

This is the ID which uniquely identifies the layout.


Ex. android:id=”@+id/edit”

2. android:hint –

Displays a hint inside the EditText before the user enters text.
Ex. android:hint=”Enter Text”

3. android:gravity –
Aligns the text inside the EditText.
Ex. android:gravity=”center”
4. android:background –
Sets the background color or drawable.
Ex. android:background=”@color/primary”

Example:

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">

<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter text" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Display Text" />

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your text will appear here"
android:textSize="18sp"
android:layout_marginTop="20dp"/>

</LinearLayout>

e. Explain any four attributes of RadioButton control. ( 4 Mks)


Ans. RadioButton in Android:

A RadioButton is a UI component in Android that allows users to select one option

Attributes of RadioButton:

1. android:text -
Sets the text displayed next to the RadioButton.
Example: android:text="Option 1"
2. android:textColor:
Changes the text color of the RadioButton.
Example:android:textColor="@color/black"

3. android:gravity
Aligns the text inside the RadioButton.
Example: android:gravity="center"

4. android:padding -
Adds space around the RadioButton.
Example: android:padding="8dp"

Example:

Activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">

<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 1" />

<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option 2" />
</RadioGroup>

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Select an option"
android:textSize="18sp"
android:layout_marginTop="20dp"/>
</LinearLayout>
f. Design a employee registration form using UI component. (6 mks)
Ans.

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">

<TextView
android:text="Employee Registration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:textStyle="bold"
android:layout_gravity="center"
android:paddingBottom="10dp"/>

<EditText
android:id="@+id/editId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Employee ID"
android:inputType="number"/>

<EditText
android:id="@+id/editName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Employee Name"
android:inputType="textPersonName"/>

<EditText
android:id="@+id/editMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile No."
android:inputType="phone"/>

<EditText
android:id="@+id/editAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Address"
android:inputType="textPostalAddress"
android:minLines="3"/>

<EditText
android:id="@+id/editPincode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pin Code"
android:inputType="number"/>

<Button
android:id="@+id/btnSubmit"
android:text="Submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"/>

</LinearLayout>

g. Explain how linear and frame layout is used to design an android application with suitable
example. (6 mks)
Ans.
1. LinearLayout
Android LinearLayout is a view group that aligns all children in either vertically or horizontally.
LinearLayout Attributes
Following are the important attributes specific to LinearLayout −

Android LinearLayout is a view group that aligns all children in either vertically or horizontally.

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Enter Your Name"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Click Me"
/>
</LinearLayout>

Sr.No Attribute & Description

android:id
1
This is the ID which uniquely identifies the layout.

android:baselineAligned
2 This must be a boolean value, either "true" or "false" and prevents the layout from aligning its children's
baselines.

android:baselineAlignedChildIndex
3 When a linear layout is part of another layout that is baseline aligned, it can specify which of its children to
baseline align.

android:divider
4 This is drawable to use as a vertical divider between buttons. You use a color value, in the form of "#rgb",
"#argb", "#rrggbb", or "#aarrggbb".

android:gravity
5 This specifies how an object should position its content, on both the X and Y axes. Possible values are top,
bottom, left, right, center, center_vertical, center_horizontal etc.

android:orientation
6 This specifies the direction of arrangement and you will use "horizontal" for a row, "vertical" for a column.
The default is horizontal.

android:weightSum
7
Sum up of child weight

2. FrameLayout
FrameLayout is a basic layout in Android.
It places all child views on top of each other, like stacking layers.
The last added view appears on top of the others.
It is useful for overlaying elements, like a text over an image.
You can adjust child views using layout_gravity to position them.

FrameLayout-specific attributes:
1. android:foreground
Adds a drawable (image, color, or shape) on top of all child views.
Example: android:foreground="@drawable/border_overlay"
2. android:foregroundGravity
Controls how the foreground drawable is aligned within the FrameLayout.
Possible values: center, top, bottom, left, right, etc.
Example: android:foregroundGravity="center"
3. android:measureAllChildren
If true, measures all child views, even GONE ones.
If false, only visible (VISIBLE or INVISIBLE) views are measured.
Example: android:measureAllChildren="true"

Activity_main.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:src="@drawable/ic_launcher"
android:scaleType="fitCenter"
android:layout_height="match_parent"
android:layout_width="match_parent"/>

<TextView
android:text="Frame Demo"
android:textSize="100px"
android:textStyle="bold"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center"
/>
</FrameLayout>

You might also like