18CSMP68 - Create an application to design a Visiting Card.

Create an application to design a Visiting Card. The Visiting card should have a company logo at the top right corner. The company name should be displayed in Capital letters, aligned to the center. Information like the name of the employee, job title, phone number, address, email, fax and the website address is to be displayed. Insert a horizontal line between the job title and the phone number.




1. Firstly Create an Application by Name “VisitingCardApp”

2. Go to xml code of design change the layout to “RelativeLayout” 

3. Add TextView component change the following properties: 

  •   Size: 38dp 
  •   Text: SUNAGAR
  •   Align left top   

4. Add Image View to design and in type choose “IC_LAUNCHER_FOREGROUND”

  • Download the logo & copy the same in res->drawable folder 
  • In xml code of imageview change srcCompat=”@drawable/logo”
  •  Align right top   
5. Add View component & change the following properties: 
  • Height: 4dp 
  • Background: “#4444” (black color)
6. Add TextView component change the following properties:
  •  Size: 20dp 
  • Text: Raju Sunagar
  •  Style: Bold 
  •  Align center   

7. Add TextView component change the following properties: 

  •  Size: 20dp
  •  Text: CSE 
  •  Align center
8. Add TextView component change the following properties: 
  • Size: 20dp
  • Text: Address-  vijayapur, karntaka, india 586101 
  • Align: center
9. Add TextView component change the following properties: 
  •  Size: 20dp 
  •  Text: Email-  sunagar@gmail.com
  •  Align: center 10. Add TextView component change the following properties: 
  • Size: 20dp 
  • Text: Phone- 818181818181
XML CODE :
 <?xml version="1.0" encoding="utf-8"?>  
 <RelativeLayout  
 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/textView"  
 android:layout_width="wrap_content"  
 android:layout_height="wrap_content"  
 android:layout_alignParentEnd="true"   
 android:layout_alignParentRight="true"  
 android:layout_alignParentBottom="true"  
 android:layout_marginStart="17dp"  
 android:layout_marginLeft="17dp"  
 android:layout_marginTop="17dp"  
 android:layout_marginEnd="244dp"  
 android:layout_marginRight="244dp"  
 android:layout_marginBottom="486dp"  
 android:text="SUNAGAR"  
 android:textSize="38dp" />  
 <ImageView  
 android:id="@+id/imageView"  
 android:layout_width="231dp"  
 android:layout_height="174dp"  
 android:layout_alignParentEnd="true"  
 android:layout_alignParentRight="true"  
 android:layout_alignParentBottom="true"  
 android:layout_marginEnd="-14dp"  
 android:layout_marginRight="-14dp"  
 android:layout_marginBottom="481dp"  
 app:srcCompat="@drawable/logo" />  
 <View  
 android:id="@+id/view"  
 android:layout_width="wrap_content"  
 android:layout_height="4dp"  
 android:layout_alignParentBottom="true"  
 android:background="#4444"  
 android:layout_marginBottom="466dp" />  
 <TextView  
 android:id="@+id/textView2"  
 android:layout_width="wrap_content"  
 android:layout_height="wrap_content"  
 android:layout_alignParentEnd="true"  
 android:layout_alignParentRight="true"  
 android:layout_alignParentBottom="true"  
 android:layout_marginEnd="117dp"  
 android:layout_marginRight="117dp"   
 android:layout_marginBottom="394dp"  
 android:text="Raju Sunagar"  
 android:textSize="30dp"  
 android:textStyle="bold" />  
 <TextView  
 android:id="@+id/textView3"  
 android:layout_width="wrap_content"  
 android:layout_height="wrap_content"  
 android:layout_alignParentEnd="true"  
 android:layout_alignParentRight="true"  
 android:layout_alignParentBottom="true"  
 android:layout_marginEnd="64dp"  
 android:layout_marginRight="64dp"  
 android:layout_marginBottom="343dp"  
 android:text="CSE"  
 android:textSize="25dp" />  
 <TextView  
 android:id="@+id/textView4"  
 android:layout_width="wrap_content"  
 android:layout_height="wrap_content"  
 android:layout_alignParentEnd="true"  
 android:layout_alignParentRight="true"  
 android:layout_alignParentBottom="true"  
 android:layout_marginEnd="127dp"  
 android:layout_marginRight="127dp"  
 android:layout_marginBottom="294dp"  
 android:text="Ph No: 9036915739"  
 android:textSize="20dp" />  
 <TextView  
 android:id="@+id/textView5"  
 android:layout_width="wrap_content"  
 android:layout_height="wrap_content"  
 android:layout_alignParentEnd="true"  
 android:layout_alignParentRight="true"   
 android:layout_alignParentBottom="true"   
 android:layout_marginEnd="10dp"   
 android:layout_marginRight="10dp"   
 android:layout_marginBottom="229dp"   
 android:text="vijayapur, karntaka, india 586101 " 
 android:textSize="20dp" />   
 <TextView  
 android:id="@+id/textView6"  
 android:layout_width="wrap_content"  
 android:layout_height="wrap_content"  
 android:layout_alignParentEnd="true"  
 android:layout_alignParentRight="true"  
 android:layout_alignParentBottom="true"  
 android:layout_marginEnd="44dp"  
 android:layout_marginRight="44dp"  
 android:layout_marginBottom="189dp"  
 android:text="Email: sunagar@gmail.com"  
 android:textSize="20dp" />  
 </RelativeLayout>  
JAVA-CODE :

 import androidx.appcompat.app.AppCompatActivity;  
 import android.os.Bundle;  
 public class MainActivity extends AppCompatActivity {  
 protected void onCreate(Bundle savedInstanceState) {  
 super.onCreate(savedInstanceState);  
 setContentView(R.layout.activity_main);  
 }  
  }