19

I want to do in my app a View that I can swipe from the bottom of the window (Images below explain it better).

I want the view to stop at certain point. The view must allow to swipe/drag it to the bottom again. Any idea or tip of how can I do that?

This is what I want to have initially

enter image description here

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
stanete
  • 4,062
  • 9
  • 21
  • 30

2 Answers2

17

I think you are in search of a ViewDragHelper:

API doc: https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.html

How to use. This answer links to a sample project to show you how as well: ViewDragHelper: how to use it?

Dragging best practices:

http://developer.android.com/training/gestures/scale.html

Community
  • 1
  • 1
Jon
  • 1,820
  • 2
  • 19
  • 43
11

You can use the new material design pattern called Bottom Sheets. They do the exact thing that you want. They also support custom layouts for the view.

Material Design - Component - Bottom Sheets

bks
  • 1,886
  • 1
  • 24
  • 43
Nithish V
  • 111
  • 1
  • 5