Implementing the dialog designs
Now, we will do something that we have done many times before, but for a new reason. As we know, we will have two dialog windows. One for the user to enter a new note and one for the user to view a note of their choice.
We can design the layouts of these two dialog windows in exactly the same way as we have designed all our previous layouts. When we come to create the Java code for the DialogFragment
classes, we will then see how we incorporate these layouts.
First, let's add a layout for our "new note" dialog:
Right-click on the
layout
folder in the project explorer and select Layout resource file under New. Enterdialog_new_note
in the File name field andRelativeLayout
in the Root element field. Click on OK to generate the new layout.Refer to the target design in the next screenshot while following the rest of these instructions:
Drag and drop PlainText (from the Text Fields category) to the very top and on the left-hand side of the layout and then add another...