Create an Android Application to display the welcome message and text to be displayed in Red color with center alignment.
Use Android StudioIDE to create an Android application and name it as My App under a package com.example.MyApp, with blank Activity.
Modify the default content of res/layout/activity_main.xml file to display the required content and design the layout.
Don’t make any changes to MainActivity.java
Run the code and launch the emulator to display the content in Android.
package com.example.workshop1;
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 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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome"
android:textSize="43sp"
android:textColor="#EF2323"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Thus a Simple Android Application Create and to display the welcome message and text to be displayed in Red color with center alignment.