0% found this document useful (0 votes)
17 views3 pages

Practical 05

The document provides two practical exercises for Android layout design. The first exercise demonstrates how to use a LinearLayout to display a name, age, and mobile number vertically on the screen. The second exercise shows how to use an AbsoluteLayout to center the same information on the display screen.

Uploaded by

harshdpatil445
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)
17 views3 pages

Practical 05

The document provides two practical exercises for Android layout design. The first exercise demonstrates how to use a LinearLayout to display a name, age, and mobile number vertically on the screen. The second exercise shows how to use an AbsoluteLayout to center the same information on the display screen.

Uploaded by

harshdpatil445
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

Practical 05

1) WAP to place name, age and mobile number linearly(Vertical) on the display screen using linear
layout.

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


<LinearLayout 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_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:padding="20dp"
android:layout_width="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="26dp"
android:text="Linear Layout"
android:layout_gravity="center"
android:textColor="@color/black"
android:textStyle="bold"
android:textAppearance="@style/TextAppearance.AppCompat.Display2" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="26dp"
android:text="Name : Minit Chitroda"
android:textColor="@color/black"
android:layout_marginTop="15dp"
android:textAppearance="@style/TextAppearance.AppCompat.Display2" />

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="26dp"
android:text="Age : 18"
android:layout_marginTop="15dp"
android:textAppearance="@style/TextAppearance.AppCompat.Display2" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="26dp"
android:text="Phone No : 1234567890"
android:textColor="@color/black"
android:layout_marginTop="15dp"
android:textAppearance="@style/TextAppearance.AppCompat.Display2" />
</LinearLayout>
Practical 05

2) WAP to place name, age and mobile number centrally on the display screen using absolute layout.

<?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_height="match_parent"
tools:context=".MainActivity"
android:padding="20dp"
android:layout_width="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="119dp"
android:layout_y="100dp"
android:textSize="24dp"
android:text="Absolute Layout"
android:layout_gravity="center"
android:textAlignment="center"
android:textColor="@color/black"
android:textStyle="bold"
android:textAppearance="@style/TextAppearance.AppCompat.Display2" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="26dp"
android:text="Name : Minit Chitroda"
android:layout_x="80dp"
android:layout_y="150dp"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/black"
android:layout_marginTop="15dp"
android:textAppearance="@style/TextAppearance.AppCompat.Display2" />

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_x="150dp"
android:layout_y="200dp"
android:text="Age : 18"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Display2"
android:textColor="@color/black"
android:textSize="26dp" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_x="70dp"
android:layout_y="250dp"
android:text="Phone No : 1234567890"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Display2"
android:textColor="@color/black"
android:textSize="26dp" />
</AbsoluteLayout>
Practical 05

You might also like