Step #3: Adjusting the TextView

We can reuse the TextView that came in the starter project, but we need to make a few changes to it. However, to change it, we need to select it first, and now it is covered by the RecyclerView that we just added. Instead, click on the TextView entry in the “Component Tree” pane of the Layout Designer:

Android Studio Layout Designer, Component Tree Pane
Android Studio Layout Designer, Component Tree Pane

Then, in the “Attributes” pane, fill in empty for the ID. Then, click on the “O” button to the side of the “text” field that has “Hello World!” as its current value:

Android Studio Layout Designer, Attributes Pane, with Arrow Pointing to Button
Android Studio Layout Designer, Attributes Pane, with Arrow Pointing to Button

This will bring up a dialog showing available string resources:

Android Studio Resource Selector
Android Studio Resource Selector

Click the “+” icon to fold open a drop-down menu, and in there choose “String Value”. This brings up a dialog to define a new string resource:

Android Studio New String Resource Dialog
Android Studio New String Resource Dialog

For the “Resource name”, fill in msg_empty. For the “Resource value”, fill in “placeholder text”:

Android Studio New String Resource Dialog, with Values
Android Studio New String Resource Dialog, with Values

As the text suggests, this is a placeholder for a better message that we will swap in later in this book.

Click “OK” to define the resource, then click “OK” to close the resource selector, and you should be taken back to the designer.

Then, in the “Common Attributes” section, fill in the following value for the “textAppearance”:

?android:attr/textAppearanceMedium

This says “we want this text to be in the standard medium text size for whatever overall UI theme we happen to be using”.

This, then, gives us what we were seeking from the outset: the RecyclerView, and the TextView, all properly configured and positioned:

Android Studio Layout Designer, Showing End Result of This Tutorial
Android Studio Layout Designer, Showing End Result of This Tutorial

If you run the app, since the MainActivity loads up this layout resource via setContentView(R.layout.activity_main), you will see the “placeholder text” and nothing else:

ToDo App, As Currently Implemented
ToDo App, As Currently Implemented

We have not put anything into the RecyclerView, so it has no content for us to see.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.