Exp 5
Exp 5
xmlns:app="http://schemas.android android:textColor="@color/white"/
.com/apk/res-auto" >
<TextView
xmlns:tools="http://schemas.androi
d.com/tools" android:layout_width="match_pare
nt"
android:layout_width="match_pare
nt" android:layout_height="wrap_cont
ent"
android:layout_height="match_par android:text="Mobile no:
ent" 8104064602"
android:background="#065535" android:gravity="center"
android:orientation="vertical" android:textSize="28sp"
tools:context=".exp5_1"> android:fontFamily="serif"
<TextView
android:textColor="@color/white"/
android:layout_width="match_pare >
nt" </LinearLayout>
android:layout_height="wrap_cont OUTPUT:
ent"
android:text="Name: Midhat
Ansari"
android:gravity="center"
android:textSize="28sp"
android:fontFamily="serif"
android:textColor="@color/white"/
>
<TextView
android:layout_width="match_pare
nt"
android:layout_height="wrap_cont
2. Write a Program to place Name, Age and Mobile number centrally on the display
screen using Absolute Layout.
CODE:
<?xml version="1.0" android:fontFamily="serif"
encoding="utf-8"?> android:textSize="32sp"
<AbsoluteLayout android:textColor="#000FFF"
xmlns:android="http://schemas.and android:layout_x="130sp"
roid.com/apk/res/android" android:layout_y="300sp"
/>
xmlns:app="http://schemas.android <TextView
.com/apk/res-auto"
android:layout_width="wrap_conte
xmlns:tools="http://schemas.androi nt"
d.com/tools"
android:layout_height="wrap_cont
android:layout_width="match_pare ent"
nt" android:text="8104064602"
android:textStyle="bold"
android:layout_height="match_par android:fontFamily="serif"
ent" android:textSize="32sp"
android:layout_gravity="center" android:textColor="#000FFF"
tools:context=".e5_2"> android:layout_x="190sp"
<TextView android:layout_y="300sp"
/>
android:layout_width="wrap_conte </AbsoluteLayout>
nt"
OUTPUT:
android:layout_height="wrap_cont
ent"
android:text="Midhat"
android:textStyle="bold"
android:fontFamily="serif"
android:textSize="32sp"
android:textColor="#000FFF"
android:layout_x="10sp"
android:layout_y="300sp"
/>
<TextView
android:layout_width="wrap_conte
nt"
android:layout_height="wrap_cont
ent"
android:text="18"
android:textStyle="bold"
3. Write a Program using Linear Layout place the Button New, Update, Save and Delete
horizontally using attribute weight and weight sum.
CODE:
<?xml version="1.0" android:layout_height="wrap_cont
encoding="utf-8"?> ent"
<LinearLayout android:text="SAVE"
xmlns:android="http://schemas.and android:layout_weight="1"
roid.com/apk/res/android"
android:textColor="@color/black"
xmlns:app="http://schemas.android
.com/apk/res-auto" android:backgroundTint="#0000FF
"
xmlns:tools="http://schemas.androi android:textSize="16sp"/>
d.com/tools" <Button
android:layout_width="match_pare android:layout_width="wrap_conte
nt" nt"
android:layout_height="match_par android:layout_height="wrap_cont
ent" ent"
android:weightSum="4" android:text="DELETE"
tools:context=".exp5_4"> android:layout_weight="1"
<Button android:textColor="@color/black"
android:backgroundTint="#0000FF
android:layout_width="wrap_conte "
nt" android:textSize="16sp"/>
android:layout_height="wrap_cont </LinearLayout>
ent"
android:text="NEW" OUTPUT:
android:layout_weight="1"
android:textColor="@color/black"
android:backgroundTint="#0000FF
"
android:textSize="16sp"/>
<Button
android:layout_width="wrap_conte
nt"
android:layout_height="wrap_cont
ent"
android:text="UPDATE"
android:layout_weight="1"
android:textColor="@color/black"
android:backgroundTint="#0000FF
"
android:textSize="16sp"/>
<Button
android:layout_width="wrap_conte
nt"
4. Write a Program to create a Login Form Using Absolute Layout.
CODE:
<?xml version="1.0" android:layout_width="400px"
encoding="utf-8"?>
<AbsoluteLayout android:layout_height="wrap_cont
xmlns:android="http://schemas.and ent"
roid.com/apk/res/android" android:layout_x="160sp"
xmlns:app="http://schemas.android android:backgroundTint="@color/
.com/apk/res-auto" black"
android:layout_y="110sp"/>
xmlns:tools="http://schemas.androi <TextView
d.com/tools"
android:layout_width="wrap_conte
android:layout_width="match_pare nt"
nt"
android:layout_height="match_par android:layout_height="wrap_cont
ent" ent"
android:background="#0000FF" android:textColor="@color/black"
tools:context=".e5_3"> android:text="Password:"
<TextView android:layout_x="20sp"
android:layout_width="match_pare android:layout_y="180sp"
nt" android:gravity="center"
android:layout_height="wrap_cont android:fontFamily="serif"
ent" android:textStyle="bold"
android:textColor="@color/black" android:textSize="24sp"/>
android:text="LOGIN <EditText
FORM" android:layout_width="400px"
android:gravity="center" android:layout_height="wrap_cont
android:fontFamily="serif" ent"
android:textStyle="bold" android:layout_x="160sp"
android:textSize="44sp"/> android:layout_y="170sp"
<TextView
android:backgroundTint="#000000
android:layout_width="wrap_conte "
nt" android:inputType="textPassword"
/>
android:layout_height="wrap_cont
ent" <Button
android:layout_width="wrap_conte
android:textColor="@color/black" nt"
android:text="Username:"
android:layout_x="20sp" android:layout_height="wrap_cont
android:layout_y="120sp" ent"
android:gravity="center" android:layout_x="125sp"
android:fontFamily="serif" android:layout_y="250sp"
android:textStyle="bold"
android:textSize="24sp"/> android:backgroundTint="@color/
<EditText black"
android:textColor="@color/white"
android:text="SUBMIT"
android:textSize="22sp"/>
</AbsoluteLayout>
OUTPUT: