0% found this document useful (0 votes)
7 views

Android_Exp-3[1]

Uploaded by

ADITYA MOHARANA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Android_Exp-3[1]

Uploaded by

ADITYA MOHARANA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Name Of The Experiment :

*Coding Phase: Pseudo Code / Flow Chart / Algorithm :

Constraint Layout
1. Start :
• Open the `activity_main.xml` file for layout design.
2. Initialize Root ConstraintLayout :-
• Create the root `ConstraintLayout` with `match_parent` for both width and height.
• Define any common attributes like padding, background color, or orientation.
3. Add UI Components (Views) :-
• ImageView :
o Add an `ImageView` with `wrap_content` dimensions.
o Constrain all sides (`Top`, `Bottom`, `Start`, `End`) to the parent, ensuring it's centered.
o Set the `app:layout_constraintVertical_bias` to adjust the vertical position slightly.
• EditText for Email :-
o Add an `EditText` for entering an email.
o Constrain it horizontally to the parent and vertically below the `ImageView` using
`app:layout_constraintTop_toTopOf`.
o Set vertical bias to position it in the desired location.
• EditText for Password:
o Add another EditText for the password.
o Constrain it horizontally to the parent and vertically below the email EditText.
o Set vertical bias to position it correctly.
• Button:
o Add a Button for submission.
o Constrain it horizontally to the parent and vertically below the password EditText.
o Set margins if necessary to adjust the position.
4. Save Layout :-
• Save the activity_main.xml file with the defined ConstraintLayout.
5. End
• The layout is now ready with components properly constrained to each other and the parent.

As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning

Linear Layout
1. Start
• Begin the layout design process in the activity_main.xml file.
2. Initialize Root LinearLayout (Vertical) :-
• Set up the root LinearLayout with a vertical orientation, filling the parent dimensions and applying
padding and background color.
3. Create First Child LinearLayout (Horizontal) :-
• Add a horizontal LinearLayout inside the root layout.
• Add EditText (Name Input) :-
o Place an EditText inside this horizontal layout for name input, setting appropriate attributes.
4. Add Second EditText (University Input) :-
• Directly under the root layout, add another EditText for university name input.
5. Create Second Child LinearLayout (Horizontal) :-
• Add another horizontal LinearLayout inside the root layout.
• Add EditText (Branch Input) :-
o Place an EditText for branch input within this horizontal layout.
• Add Button (Submit) :-
o Add a Button next to the EditText for submission.
6. End
• Finalize and save the activity_main.xml layout.

Relative Layout
1. Start
• Open the activity_main.xml file for layout design.
2. Initialize Root RelativeLayout:
• Create the root RelativeLayout with match_parent for both width and height.
• Define any common attributes like padding.
3. Add UI Components (Views):
• TextView:
o Add a TextView for displaying text.
o Set the layout_width to wrap_content and layout_height to wrap_content.
o Position the TextView using android:layout_marginTop and android:layout_marginLeft attributes.
• EditText:
o Add an EditText for user input.
o Set the layout_width to match_parent and layout_height to wrap_content.
o Position the EditText below the TextView using android:layout_below.
o Add margins if necessary.
• Button:
o Add a Button for submission.
o Set the layout_width to wrap_content and layout_height to wrap_content.
o Position the Button below the EditText using android:layout_below.
o Align the button to the right side of the parent using android:layout_alignParentRight.
o Set margins to adjust its position.
• ImageView:
o Add an ImageView for displaying an image.
o Set the layout_width and layout_height to wrap_content.
o Position the ImageView below the Button using android:layout_below.
As applicable according to the experiment.
o Adjust the position using margins like android:layout_marginTop Twoand android:layout_marginLeft.
sheets per experiment (10-20) to be used.
4. Save Layout
Applied and Action Learning

• ImageView :-
o Add an ImageView for displaying an image.
o Set the layout_width and layout_height to wrap_content.
o Position the ImageView below the Button using android:layout_below.
o Adjust the position using margins like android:layout_marginTop and android:layout_marginLeft.
4. Save Layout :-
• Save the activity_main.xml file with the defined RelativeLayout.
5. End

Table Layout
1. Start :-
• Open the activity_main.xml file.
2. Define TableLayout:
• Create a TableLayout element with optional attributes:
o android:layout_width="match_parent"
o android:layout_height="match_parent"
o Optional attributes for padding and background.
3. Add TableRows:
• Create Header Row:
o Define a TableRow with a background color and padding.
o Add TextView elements inside this row for the header labels (e.g., "Name", "Registration Number",
"City").
o Set properties like android:layout_width, android:layout_height, android:layout_weight,
android:textColor, and android:textSize.
• Create Data Rows:
o For each TableRow, add TextView elements corresponding to the data fields (e.g., names,
registration numbers, cities).
o Set properties similar to the header row.
4. Set Attributes for TextView:
• For each TextView, ensure properties like android:layout_width, android:layout_height,
android:layout_weight, android:textColor, and android:layout_gravity are set appropriately.
5. End:
• Save and review the XML layout.

As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Testing Phase :- Compilation of Code (Error Detection)

Constraint Layout :-

Linear Layout :-

Relative Layout :-

Table Layout :-

As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning

Implementation Phase:Final Output (No Error)


Constraint Layout
Activity_main.xml :-
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@android:dimen/app_icon_size"
android:background="#FFEB3B"
tools:context=".MainActivity">

<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.014"
app:srcCompat="@drawable/img" />

<EditText
android:id="@+id/editTextTextEmailAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter your E-mail"
android:inputType="textEmailAddress"
android:textColor="@color/black"
android:textColorHint="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.571"
tools:ignore="TouchTargetSizeCheck" />

<EditText
android:id="@+id/editTextTextPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter Your Password"
android:inputType="textPassword"
android:textColor="@color/black"
android:textColorHint="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.715"
As applicable according to the experiment.
tools:ignore="TouchTargetSizeCheck" /> Two sheets per experiment (10-20) to be used.
Applied and Action Learning

* Implementation Phase:Final Output (No Error)


app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.715"
tools:ignore="TouchTargetSizeCheck" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="84dp"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<EditText
android:id="@+id/editTextText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text"
android:text="Enter your name"
android:hint="Enter your name"
android:textColorHint="@color/black"
android:textColor="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.428"
tools:ignore="TouchTargetSizeCheck" />

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.kt :-

package com.example.constraintlayoutapp

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)

}
}

*As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning
* Implementation Phase:Final Output (No Error)
Linear Layout :-
Activity_main.xml :-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@android:dimen/app_icon_size"
android:background="#FFEB3B"
tools:context=".MainActivity">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<EditText
android:id="@+id/editTextText2"
android:layout_width="174dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Enter your name"
android:inputType="text"
android:textColor="@color/black"
android:textColorHint="@color/black"
tools:ignore="DuplicateIds,TouchTargetSizeCheck" />

</LinearLayout>

<EditText
android:id="@+id/editTextText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter your university name"
android:textColor="@color/black"
android:inputType="text"
android:textColorHint="@color/black"
tools:ignore="DuplicateIds,TouchTargetSizeCheck" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<EditText
android:id="@+id/editTextText2"
android:layout_width="174dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter your branch"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:inputType="text"
tools:ignore="DuplicateIds,TouchTargetSizeCheck" />

<Button *As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
android:id="@+id/button2"
android:layout_width="142dp"
Applied and Action Learning
* Implementation Phase:Final Output (No Error)
tools:ignore="DuplicateIds,TouchTargetSizeCheck" />

<Button
android:id="@+id/button2"
android:layout_width="142dp"
android:layout_height="match_parent"
android:text="Submit"
tools:ignore="TouchTargetSizeCheck" />

</LinearLayout>

</LinearLayout>

MainActivity.kt :-

package com.example.linearlayoutapp

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)

}
}

Relative Layout :-
Activity_main.xml :-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="120dp"
android:text="Hello, World!"
android:textSize="24sp" />

<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textView"
android:layout_marginTop="70dp"
android:hint="Enter your name"
tools:ignore="TouchTargetSizeCheck" />

<Button
android:id="@+id/button" *As applicable according to the experiment.
Two sheets per experiment (10-20) to be used.
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Applied and Action Learning
* Implementation Phase:Final Output (No Error)
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editText"
android:layout_alignParentRight="true"
android:layout_marginTop="106dp"
android:layout_marginRight="140dp"
android:text="Submit" />

<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/button"
android:layout_marginTop="27dp"
android:layout_marginLeft="80dp"
android:src="@drawable/img" />

</RelativeLayout>

MainActivity.kt :-

package com.example.relativelayoutapp

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)

}
}

Table Layout :-
Activity_main.xml :-
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">

<!-- Header Row -->


<TableRow
android:background="#D88181"
android:padding="5dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:textStyle="bold" *As applicable according to the experiment.
Two sheets per experiment (10-20) to be used.
android:textSize="15sp"
android:text="Name" />
Applied and Action Learning
* Implementation Phase:Final Output (No Error)
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="15sp"
android:text="Name" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="15sp"
android:text="Registration Number" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="15sp"
android:text="City" />
</TableRow>

<!-- Data Rows -->


<TableRow>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Jyoti Prakash Patra" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="220301120254" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Bhagabanpur" />
</TableRow>

<TableRow>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Sushanta Kumar Patra" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content" *As applicable according to the experiment.
Two sheets per experiment (10-20) to be used.
android:layout_weight="1"
android:layout_gravity="center"
Applied and Action Learning
* Implementation Phase:Final Output (No Error)
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="220309337623" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Balasore" />
</TableRow>

<TableRow>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Debajani Patra" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="220301183379" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Saragaonn" />
</TableRow>

<TableRow>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Omm Prakash Patra" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="220301178487" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black" *As applicable according to the experiment.
Two sheets per experiment (10-20) to be used.
android:text="Bhadrak" />
</TableRow>
Applied and Action Learning
* Implementation Phase:Final Output (No Error)

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Bhadrak" />
</TableRow>

<TableRow>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Jyoti Prakash Patra" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="220301163715" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textColor="@color/black"
android:text="Balasore" />
</TableRow>

</TableLayout>

MainActivity.kt :-

package com.example.tablelayoutapp

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)

}
}

*As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning
* Final Output (no error) :
Constraint Layout

Linear Layout

*As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.
Applied and Action Learning
* Final Output (no error) :
Relative Layout

Table Layout

Rubrics FULL MARK

Concept 10
Planning and Execution/ 10
Practical Simulation/ Programming
Result and Interpretation 10
Record of Applied and Action Learning 10
Viva 10
Total 50
Signature of the Faculty: Signature of the Student:

*As applicable according to the experiment.


Two sheets per experiment (10-20) to be used.

You might also like