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

Android App: Display User Info Layout

The document provides two Android programming exercises focused on displaying user information (Name, Age, and Mobile Number) using different layouts. The first exercise uses a LinearLayout to arrange the information vertically, while the second exercise employs an AbsoluteLayout to position the elements centrally on the screen. Each exercise includes the XML layout code and the corresponding Java class for the main activity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Android App: Display User Info Layout

The document provides two Android programming exercises focused on displaying user information (Name, Age, and Mobile Number) using different layouts. The first exercise uses a LinearLayout to arrange the information vertically, while the second exercise employs an AbsoluteLayout to position the elements centrally on the screen. Each exercise includes the XML layout code and the corresponding Java class for the main activity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practical No:-5

Q1].Write a program to place Name, Age and Mobile No?


Main_Activity.xml
?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_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"

tools:context=".MainActivity">

<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#FFEB3B"
android:backgroundTint="#E91E63"
android:text="Student Name: Geetanjli Deshmukh"
android:textSize="25dp"
android:textStyle="italic" />

<TextView

android:layout_width="match_parent"
android:layout_height="45dp"
android:background="#E91E63"
android:backgroundTint="#FFEB3B"
android:text="age:18"
android:textSize="25dp"
android:textStyle="italic" />

<TextView

android:layout_width="match_parent"
android:layout_height="51dp"
android:background="#00BCD4"
android:backgroundTint="#3F51B5"
android:text="Mobail No. 1681668392"
android:textSize="25dp"
android:textStyle="italic"
</LinearLayout>
MainActiviti.java

package com.example.linea;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Output:-

Q2.Write a Program to place Name, Age and Mobile Number


Centrally on the display screen using absolute layout.
Code:
<?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:id="@+id/textView2"
android:layout_width="377dp"
android:layout_height="wrap_content"
android:layout_x="54dp"
android:layout_y="369dp"
android:background="#FFEB3B"
android:backgroundTint="#E91E63"
android:baground="#E91E63"
android:text="Name:Geetanjli Deshmukh"
android:textSize="30dp" />

<TextView

android:layout_width="377dp"
android:layout_height="wrap_content"
android:layout_x="57dp"
android:layout_y="420dp"
android:background="#EFEEE5"
android:backgroundTint="#49C2C6"
android:baground="#F490B2"
android:text="Age:18"
android:textSize="30dp" />

<TextView
android:layout_width="393dp"
android:layout_height="38dp"
android:layout_x="48dp"
android:layout_y="475dp"
android:backgroundTint="#DDE86B"
android:baground="#8FDF92"
android:text="Mobail No.7845364739"
android:textSize="30dp"
</AbsoluteLayout>

.java
package com.example.absolute;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

You might also like