0

I'm trying to implement a sliding menu, like in Prixing app. (The menu which lays under main layout and get visible when you take and drag main layout to the side) But the trick is - i want it to appear on bottom of the screen, so I need to move the main layout to the top. The second problem is that in tah layout I got a listview. Please, I really need advices or maybe link to some usefull resources where I can understand how touch events are handled. Thx!

Graykos
  • 1,281
  • 3
  • 20
  • 31

2 Answers2

0

i think you are try to do same as facebook app. i have found demo for it. so use this

Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75
0

there's really no magic on it.

To make it, move directly (in a button click or something): you use a animation to change the LayoutParams.top from both fragments (the one on top (currently in view, and the one on the bottom, hidden under the screen).

On your XML layout make sure to set a fixed height for the bottom layout (in DIP) and during runtime animate the two layouts to move that amount of pixels.

To make it move with the user finger: That will be tricky, because the listview MUST receive the the user input. Maybe if you call super on it.

But you can accomplish it by receiving OnTouchEvents:

  • TOUCH_DOWN, you start the move (mark it with a boolean or something)
  • TOUCH_MOVE, you apply the same change to the layout params that you did on the animation (1st option)
  • TOUCH_UP or TOUCH_CANCEL, you stop the move (clear the flag).

hope it helps pointing you to the right direction.

Budius
  • 39,391
  • 16
  • 102
  • 144