0

I have a RelativeLayout which contains a lot of child views. I want to make one of these child viewgroups to be able to be swiped horizontally and be replaced with another viewgroup.

All the examples and tutorials I've come across are all talking about whole pages, or swiping with Tabs, which I didn't use.

What am I looking for, does anyone know a good example code I can look at?

1 Answer 1

1

This answer by Marek Sebera is very easy and fast to implement, and allows you to set the swipe listener to only the child you want to set it to and have the function replace the views when it's detected.

3
  • Upvote for speed and accuracy. Will mark it as correct after I've taken a look and got it working for myself. Thanks man! :)
    – ThomQ
    Apr 3, 2014 at 23:24
  • The answer only lets me detect which way is being swiped. It does not go into detail on how to actually move certain viewgroups inside a relative layout. Do you have any idea on how that is handled?
    – ThomQ
    Apr 4, 2014 at 0:11
  • Do you want it to move as you drag it? This answer doesn't include animation as you drag it - although you could program your own animation after the swipe is detected. Or are you saying you're not sure how to replace the views in the relativelayout with the new viewgroup?
    – Nickel
    Apr 4, 2014 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.