Swipe Back like Pinterest or Tumblr

后端 未结 10 624
广开言路
广开言路 2020-12-22 16:51

Does anybody has an idea how Pinterest or Tumblr has implemented there \"swipe back\" method.

i.e. on Pinterest you can click on a post on the news feed. Than the

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 17:08

    I would suggest doing the following:

    Firstly detect the gesture that the user is doing in the device. You can refer to this link

    I am not going to copy the relevant code from the above link, as I believe it is the accepted answer

    Secondly you can in this method

    public void onSwipeLeft() {
        Toast.makeText(MyActivity.this, "left", Toast.LENGTH_SHORT).show();
    }
    

    Do the following as suggested by this question

    They there talk about finishing an activity with an animation

    Look into doing it through a theme. You can define enter exit animations for activities or the entire application
    

    Hope this helps you

提交回复
热议问题