34,333
edits
Changes
→Changing the Floating Action Button
When the Snackbar appears on a narrower device (as is the case in Figure 44-4 above) note that the floating action button is moved up to make room for the Snackbar to appear. This is handled for us automatically by the CoordinatorLayout container in the activity_fab_example.xml layout resource file.
== Changing Changing the Floating Action Button ==
Since the objective of this example is to configure the floating action button to add entries to a list, the email icon currently displayed on the button needs to be changed to something more indicative of the action being performed. The icon that will be used for the button is named ic_add_entry.png and can be found in the project_icons folder of the sample code download available from the following URL:
https://www.ebookfrenzy.com/retailweb/androidstudio32/index.php
Locate this image in the file system navigator for your operating system and copy the image file. Right-click on the app -> res -> drawable entry in the Project tool window and select Paste from the menu to add the file to the folder:
Click on the OK button to apply the new accentColor setting, return to the activity_fab_example.xml file and verify that the floating action button now appears with an orange background.
<htmlet>androidstudio32</htmlet>
== Adding the ListView to the Content Layout ==