Practical No. 05
Practical No. 05
Practical No. 05
Experiment No. 05
Title of the experiment Develop a program to implement linear layout and absolute layout.
LinearLayoutManager
GridLayoutManager
StaggeredGridLayoutManager
FrameLayout
RelativeLayout
ConstraintLayout
TableLayout
FlowLayout
GridLayout
CoordinatorLayout
FlexboxLayout
PercentRelativeLayout
AppBarLayout
DrawerLayout
ScrollView
CardView is a new widget in Android that can be used to display any sort of data by
providing a rounded corner layout along with a specific elevation.
CardView is the view that can display views on top of each other.
The main usage of CardView is that it helps to give a rich feel and look to the UI design.
This widget can be easily seen in many different Android Apps.
CardView can be used for creating items in listview or inside Recycler View.
The best part about CardView is that it extends Framelayout and it can be displayed on
all platforms of Android.
1. Write a program to place Name, Age and mobile number linearly (Vertical) on the display
screen using Linear layout.
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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:layout_gravity="center"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name: Diksha Sunil Jadhav"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:textSize="25dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age:17"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:textSize="25dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile No.: 9456201354"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:textSize="25dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Class: CO6IA"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:textSize="25dp"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
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"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="49dp"
android:layout_y="211dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="Name: Diksha Sunil Jadhav"
android:textSize="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="148dp"
android:layout_y="279dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="Age: 17"
android:textSize="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="65dp"
android:layout_y="346dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="Mobile No.: 9852147563"
android:textSize="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="125dp"
android:layout_y="413dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:text="Class: CO6IA"
android:textSize="25dp" />
</AbsoluteLayout>