Reputation: 376
I have a floating action button that, when pressed, starts a new activity.
Is there a way to animate it like on Google's Material design guidelines? I'm talking about something like this (from here).
Upvotes: 4
Views: 2424
Reputation: 1229
As i have created a file in anim folder
right_bottom_up.xml
<?xml version="1.0" encoding="utf-8"?>
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/time_fade"
android:fromXDelta="100%p"
android:fromYDelta="100%p"
android:toYDelta="0%p"
android:toXDelta="0%">
</translate>
no_animation.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
></translate>
slide_down_back.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/time_fade"
android:fromYDelta="0%p"
android:toYDelta="100%p"></translate>
In activity start your activity after intent calling:
overridePendingTransition(R.anim.right_bottom_up, R.anim.no_animation);
in your second activity onBackPress() write this line
overridePendingTransition(R.anim.no_animation, R.anim.slide_down_back);
Upvotes: 1
Reputation: 244
Refer Below lib project , its same as you share video in this question.
https://github.com/gowong/material-sheet-fab
May be this definitely helps you.
Upvotes: 0