0% found this document useful (0 votes)
7 views5 pages

Practical No 5

The document contains XML code for two Android layouts, one using a LinearLayout and the other an AbsoluteLayout, displaying user information such as name, age, and mobile number. Additionally, it includes Java code for a MainActivity that sets the content view to the layout. The layouts are designed to present user details in a structured format within an Android application.

Uploaded by

prasad wadkar
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)
7 views5 pages

Practical No 5

The document contains XML code for two Android layouts, one using a LinearLayout and the other an AbsoluteLayout, displaying user information such as name, age, and mobile number. Additionally, it includes Java code for a MainActivity that sets the content view to the layout. The layouts are designed to present user details in a structured format within an Android application.

Uploaded by

prasad wadkar
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
You are on page 1/ 5

Practical No : 5

Input :-
XML code:-

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


<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="top|center"
android:layout_marginTop="80dp"
android:padding="20dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name : Nilkant"
android:textSize="20dp"
android:layout_margin="10dp">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age : 20"
android:textSize="20dp"
android:layout_margin="10dp">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Moblie No: 8487374933"
android:textSize="20dp"
android:layout_margin="10dp">
</TextView>
</LinearLayout>

Java Code:-
package com.example.practical51;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
}
}
Output:-

2)
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/nameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name: JOY"
android:textSize="20sp"
android:layout_x="150dp"
android:layout_y="250dp"/>

<TextView
android:id="@+id/ageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age: 20"
android:textSize="20sp"
android:layout_x="150dp"
android:layout_y="300dp"/>

<TextView
android:id="@+id/mobileText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile: 96845687982"
android:textSize="20sp"
android:layout_x="150dp"
android:layout_y="350dp"/>

</AbsoluteLayout>

You might also like