quote

Create a Simple Android Application | Quotes App | Basics | Android Studio Tutorail

0:00
Toggle fullscreen Fullscreen button

Sharing buttons:

In this video, let's create a simple android application, which displays predefined quotes,

randomly.

This is what we are going to build.

Let's begin.

Open android studio.

Let the name of the application be 'Quote'.

Choose default settings for a quick set up.

Once the build is completed, let's open XML file and create a simple user interface.

Change the layout to 'RelativeLayout'.

It's one of the simplest layout.

We will remove the textview and add a button.

Let the button text be 'Next Quote'.

In relative layout, we can place the element in the center using 'layout_centerInParent'

attribute.

Next, we will create a textview, where the quote will be displayed.

If we use the 'layout_centerInParent' attribute again, it will overlap the button.

So, we will use the 'layout_above' attribute to place it above the button.

The ID of the button should be specified as its value.

For that, let's add a new ID to the button.

Use this ID as the value for 'layout_above' attribute.

For a better alignment, we can set the 'layout_centerHorizontal' to true.