Composing messages
The next screen is a bit more complicated; we will need to create a ListView
that uses multiple layout files for each row, depending on the type of the row. We'll also need to perform some layout tricks to place a view below the ListView
and set up the ListView
to autoscroll.
For the next screen, let's begin by creating a new layout named Messages.axml
in the layout
folder of the Resources
directory and then perform the following steps:
Drag a new ListView onto the layout. Set its Id to
@+id/messageList
.Check the box for Stack From Bottom, and set Transcript Mode to
alwaysScroll
. This will set it up to display items from the bottom up.Set the Weight value to
1
for the ListView in the Layout tab under the LinearLayout section.Drag a new RelativeLayout onto the layout. Let its Id be the default value, or remove it.
Drag a new Button inside RelativeLayout. Set its Id to
@+id/sendButton
.Check the box for Align Parent Right in the Layout tab.
Drag a new Plain Text found in the...