2

I am working on the application in which:

User will have a control to change the background and text (multiples) by doing horizontal swipe for BG and vertical swipe for text. In this case, if I am changing BG, text should remain constant and if I am changing text then BG should remain constant.

Also, I want to add Rubber Band effect like in iOS when user changes Text and BG.

I am thinking of twoway-view library to support for vertical and horizontal scrolling. But how to use this library in my case?

Any idea/solution will be appreciated.

Swapnil Sonar
  • 2,232
  • 2
  • 29
  • 42

3 Answers3

1

twoway-view implements an AdapterView that can scroll vertically or horizontally, but not both at the same time. It wouldn't work in your case.

I would use a ViewPager in which each fragment:

  1. Shows a certain background
  2. Lets the user select the text through swipe up and down gestures.

To obtain a rubber band effect, just add a BounceInterpolator to the animation that moves the text up & down. In the ViewPager you could get a similar effect applying a custom PageTransformer.

ivagarz
  • 2,434
  • 22
  • 22
  • Please have a look at my question [here](http://stackoverflow.com/questions/37561357/how-to-achieve-a-bounce-elastic-animation-effect-in-viewpager). You have mentioned a similar approach in your answer in general terms. I would appreciate it if you could provide a detailed solution with code. – Yash Sampat Jun 17 '16 at 11:03
0

You will probably need to use a combination of GestureDetector, SimpleOnGestureListener and TranslateAnimation on your layout. This can be fairly involved but you can find a Translation example at this SO question and GestureDetector/SimpleOnGestureListener example here. Hopefully you can figured out how to adapt the code to suit your needs.

Community
  • 1
  • 1
Dave S
  • 3,378
  • 1
  • 20
  • 34
0

You can try this library for the Rubber Band effect: AndroidViewAnimations

Jambo
  • 1
  • 1
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Rory McCrossan Jul 14 '15 at 12:38