3

in an android application, I need to do the following:

I have a view, that acts like a menu, I can slide it from the bottom-up. However I want to have 3 states: closed, half-opened and opened.

Please refer to this pic:

Closed. half-opened. opened

The blue section is the Handle, the user will use it to slide up/down or fling...

This is a bit similar to the android 5 notification bar, where you drag down to reveal half the view, then another drag down will reveal the whole view.

I can start implementing it in the onTouch of the blue section but that would require me to handle a lot of cases, especially the ones where the user flings vs slowly drag.... Is there any easier way or library that can help?

Thank you very much

Y2theZ
  • 10,162
  • 38
  • 131
  • 200
  • for half opened I think you might set the height of sliding layout to somewhere around 300 and then on further sliding you can set it to `match_parent` – Logic Jun 23 '15 at 11:20
  • also I want this 3 state Slider Layout – Amitabha Biswas Mar 21 '16 at 10:22
  • @AmitabhaBiswas I ended up using this: https://github.com/umano/AndroidSlidingUpPanel – Y2theZ Mar 21 '16 at 11:36
  • @Youssef, your link is 2 sate, can you converted to 3 state? can you provide me your demo. – Amitabha Biswas Mar 21 '16 at 11:45
  • @AmitabhaBiswas it support 3 states. you need to add `sothree:umanoAnchorPoint="0.5"` in the xml layout (or you can set the anchor point programatically). 0.5 means the third state is half the screen – Y2theZ Mar 21 '16 at 11:49
  • yes its working thankx @Youssef , But I have another requirement.. this 3 state should be done by onClick only.. thats mean from Center to Top its goto with Swipe.. not onClick.. is it possible? – Amitabha Biswas Mar 21 '16 at 12:16
  • @AmitabhaBiswas I don't know exactly as I didn't try. but you can change the state of the panel programmatically, so I would do it in a way to disable the dragging and add my own onClick events – Y2theZ Mar 21 '16 at 12:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/106974/discussion-between-amitabha-biswas-and-youssef). – Amitabha Biswas Mar 22 '16 at 05:42

0 Answers0