Zero
Zero

Reputation: 1904

Alternatives to using OnFling

So I'm working on an app in which I have a bar that the user should be able to kind of "pull open". It should expand when the user swipes up. I've been thinking about how to do this. I know I could probably use the OnFling method in GestureDetector on the layout and detect a vertical fling, but this would probably be quite fiddly for the user and bulky in code. I feel there must be alternative ways of doing this. Does anybody have any suggestions?

Upvotes: 2

Views: 81

Answers (1)

Anup Cowkur
Anup Cowkur

Reputation: 20553

You should check out ViewDragHelper. It's a component meant to help move around child views within a ViewGroup. A very cool project that uses it and already does what you are trying to accomplish is called SlidingUpPanel. You can check out it's source or use it directly.

Upvotes: 2

Related Questions