Look at how to use the floating action button in code to hook up an event handler.
- [Instructor] Now that we have…a floating action button in our layout,…let's make an event handler…to catch when the user touches it.…I'm going to go in and look at our main activity.…One thing I notice is the namespace of our main activity…is just MaterialDesign and by convention…I like to make that the same as the folder it's in…so I'm going to change that to Activities.…That'll match the namespace of the add activity as well.…At the bottom of our OnCreate method…we can wire up our event handler…for when the floating action button is touched.…I'm going to go here.…
The first thing I'm going to do…is grab a reference to the floating action button…create a variable and we're going to call that…fab for floating action button.…We'll set that equal to the value of FindViewById…and we'll cast that to a floating action button.…We'll open that up and set that equal to the resource…that we had for the ID.…That is fab_add.…
I'm going to go in and fix this reference…so it adds the using statement…for the floating action button…
- Breaking down a material design layout
- Adding AppCompat
- Adding icons and floating action buttons
- Animating the appearance
- Creating a RecyclerView
- Creating a ViewHolder
- Modifying the adapter
- Adding CardView
- Adding transition animations
- Adding a Snackbar
- Working with CoordinatorLayout
Skill Level Intermediate
F# and Xamarin Development Basicswith Rachel Blasucci56m 43s Intermediate
1. What Is Android Material Design?
2. Implementing Material Design
3. Floating Action Button
View state change animations4m 17s
Next steps1m 40s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.