Swipe among activities in android

2020-06-05 04:25发布

问题:

i have 4 activities in which i have to swipe them right, left and if i am in last activity and swipe to the left then again first activity should be shown.

can anybody have any idea how i can achieve this? or some sample code?

thanks a lot.

回答1:

you can achieve it by animaton.. But it will show as a Gallery view and you can swipe as well... OnTouchEvent on every activity you can call another activity using intents by overridePendingTransition(R.anim.act_back_slide_enter, R.anim.act_back_slide_leave);

//overridePendingTransition("animation for activity which enters", "animation for activity which leaves");

I have not yet tried this... but we can make it in this form.. If you get success let me know.



回答2:

@sajjoo Here goes your answer in deezapps widget with the questions below pointing at it

  • How to show multiple screens with right/left slide Gesture
  • How to create a slider screen (As in Tweetdeck) in Android?

and many more linked questions..



回答3:

I recently posted a question that covers a lot of this (my question is about using Swipe together with ScrollView, the Swipe gesture by itself works just fine):

Swipe/Fling tab-changing in conjunction with ScrollView?

If you read the sources I have listed and use the code I've provided then you should be able to do it.



回答4:

It's work fine... just must to delete the redundant R.java file...!

http://www.codeshogun.com/blog/2009/04/16/how-to-implement-swipe-action-in-android/