Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android. Swipe to back Activity like Telegram

How to swipe to previous activity using gesture and animation like in Telegram and Tinder app?

like image 475
Дмитрий Колмогоров Avatar asked May 28 '15 19:05

Дмитрий Колмогоров


2 Answers

Telegram is using it's own created fragments.They Created a class named ActionBarLayout which is basically a FrameLayout and is added to the main Activity and the fragment is just a view class (called TelegramFragment) that is added to the ActionBarLayout (they are kept in a list and much faster than normal fragments (with a bit less features).

To do the animation , they just animate the added view.

You can see the classes work in action HERE and HERE

like image 125
Adib Faramarzi Avatar answered Sep 19 '22 11:09

Adib Faramarzi


there is a good library on github where I gave my contribute: it handles this feature both with activities and fragments.

https://github.com/r0adkll/Slidr

like image 22
GabrieleG Avatar answered Sep 23 '22 11:09

GabrieleG