You are on page 1of 3

Pranav Mhatre

CO6IA, MAD

Experiment 5_1

Java Code:
package com.example.exp51;

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);

XML Code:
<?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:layout_marginTop="100dp"
android:layout_marginLeft="100dp"
android:orientation="vertical"
tools:context=".MainActivity">

<TextView
Pranav Mhatre
CO6IA, MAD

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="Name: Pranav Mhatre"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age: 18"

app:layout_constraintBottom_toBottomOf="parent"
android:padding="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone No.: 7218422122"
android:padding="10dp"
/>
</LinearLayout>
Pranav Mhatre
CO6IA, MAD

Output:

You might also like