I have an activity and another activity. I want my first activity to end when I slide up the screen. The animation should be like the activity is sliding up too. Like the notification screen. Is that possible? I have done many Google searches before posting this question, but could not get anything.
P.S - I don't want this to be seen as a casual question since there is no code shown. I just need some point to start and I am completely baffled.
On your Android phone or tablet, install Gboard. Open any app that you can type with, like Gmail or Keep. Tap where you can enter text. Slide your finger across the letters to spell the word you want.
Create ImageView in the activity_main. xml along with buttons that will add animation to the view. Navigate to the app > res > layout > activity_main. xml.
Android's transition framework allows you to animate all kinds of motion in your UI by simply providing the starting layout and the ending layout.
make an anim folder in res->
Make an xml file in anim folder slide_up_info.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="500"
android:fromYDelta="100%p"
android:toYDelta="0" />
</set>
slide_down_info.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="500"
android:fromYDelta="0%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:toYDelta="100%p" />
</set>
no_change.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%p" android:toYDelta="0" android:duration="500"/>
</set>
Now when you want to activity up then write below code
Intent intent_info = new Intent(MainActivity.this,ToActivity.class);
startActivity(intent_info);
overridePendingTransition(R.anim.slide_up_info,R.anim.no_change);
For down Activity animation
Intent intent_home=new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent_home);
overridePendingTransition(R.anim.no_change,R.anim.slide_down_info);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With