Thanks for all the answers. Here is what I did to make it work:
I used overlapping fragments and animations as suggested. While onCreate, I manually calculated the width for the map (shielding is the size of the box when minimized) so that it does not stretch weirdly when the box is resized. I installed the box inside the fragment, and the fragment was visible at all times. After that, I implemented OnGestureListener and made a GestureDetector for my activity and started listening to touch events from the box:
drawer.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View view, MotionEvent e) { gestureDetector.onTouchEvent(e); return false; } });
and then onFling-method
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if(velocityX < -250) { //animation for increasing the list width from 80 to 240 } else if (velocityY > 250 ) { //animation for decreasing the list width from 240 to 80 } return true; }
source share