Mad 1 Program
Mad 1 Program
Aim:
To develop a Simple Android Application that uses GUI components, Font and
Colors.
Procedure:
Creating a New project:
Open Android Stdio and then click on File -> New -> New project.
new project
Then select the Minimum SDK as shown below and click Next.
minimum sdk
Then delete the code which is there and type the code as given below.
Code for Activity_main.xml:
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:gravity="center"
android:text="Hello World!"
android:textSize="25sp"
android:textStyle="bold" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:text="Change font size"
android:textSize="25sp" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:text="Change color"
android:textSize="25sp" />
</LinearLayout>
Now click on Design and your application will look as given below.
design
Then delete the code which is there and type the code as given below.
Code for MainActivity.java:
package com.example.exno1;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
Result:
Thus a Simple Android Application that uses GUI components, Font and
Colors is developed and executed successfully.