Android floating action button animations

preview_player
Показать описание
In this tutorial you will learn how to create android floating action button with animations. Basically when you click on floating action button it will show up another floating action buttons (menu) with text label next to each button.

Here is how to do it:
- Add 2 android floating action button, one is used to make a call to a number and the other one is used to send sms message

- Set an icon for the buttons like this:

- Add 2 LinearLayout with horizontal orientation, each of these LinearLayout will hold 1 floating action button and textview label

android:visibility="gone"

- Do setOnClickListener for main floating action button, inside the onClick method is where we are going to handle the visibility of the 2 LinearLayout that we've just created

- Do setOnClickListener for call & sms floating action button

- Now will create Android resource directory and name it (anim) and set it's resource type as (anim) as well

- Next will create 4 animation files: first 2 files will handle rotate animation for the android floating action button icon and the other 2 files are used for moving the floating action button animation

- That's it!!

- You may refer to this website for Google material design icons:

Social media:
Рекомендации по теме
Комментарии
Автор

great video.. It was really thank you so much . you save my time

rijojose
Автор

Thanks a lot, really helped me out!
Edit after finishing the video:
Leave out the android:fillAfter="true" in the hide and show_layout.xml because if you don't, you'll have the bug that the buttons will still be clickable even though the hide animation has been played

Movkus
Автор

Very Good, Keep going, There is a need for tutorial of 2.2.3 version, that you are currently filling.

Orlyxs-ThaeChungWyn
Автор

just curious, do you use ConstraintLayout for this?

hafizoktri
Автор

Great tutorial - but how do we prevent the shadow clipping that occurs during the animation on the sub fab's? Thanks

ryantbwarren
Автор

Great video thanks. But my buttons start out showing instead of hidden. Any idea why?

HeathBilbrey
Автор

Help...How to change activities using OnClicklistener....PLz help

kamalmuradov
Автор

Really good video. I just didn't get how the mini fab buttons can get visible after we click the normal fab. Anyone can help me please?

marcocaspani