Working with button and text box

WORKING WITH BUTTON AND TEXT BOX

ROLL NO:

File name: MainActivity.java

package com.example.myfirstapp:

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

FILE NAME: ACTIVITY MAIN.XML

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

<androidx.constraintlayout.widget.ConstraintLayout

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="wrap content"

android:layout height="wrap_content"

android:layout_marginStart="3dp"

android:layout marginTop="56dp"

android:layout marginEnd="6dp"

android:text="enter ypur name"

app:layout_constraintEnd_toStartOf="@+id/editTextTextPersonNam e2"

app:laycut_constraintstart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/editTextTextPersonName2"

android:layout_width="wrap_content"

android:layout height="wrap_content"

android:layout_marginTop="56dp"

android:ems="10"

android:inputType="textPersonName"

android:text="Name"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintstart_toEndOf="@+id/textView2"

app:layout_constraintTop_toTopOf="parent" />

<Button

android:id="@+id/button3"

android:layout_width="wrap_content" android:layout height="wrap_content"

android:layout_marginStart="100dp"

android:layout marginTop="46dp"

android:text="Button"

app:layout_constraintstart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonNa me2" />

</androidx.constraintlayout.widget.ConstraintLayout>

Comments

Popular posts from this blog

Artificial Intelligence lab

DATAMINING AND DATAWAREHOUSING