Android - How to implement navigation that is partially visible at all times?

I would like to have a NavigationDrawer in my Android project that shows the ListView partially at all times, and the elements are also clickable, but when the user drags the box, the full ListView appears.

Below is what I'm trying to achieve:

enter image description here

The first is the "Normal View", where you can see small icons. Secondly, when the user moves the navigation box so that it opens. The third - when you are in normal mode, the user presses A and C so that the icons change color.

Any recommendations how to do this?

Thanks for answering:)

+4
source share
3 answers

I came across this open source library, https://github.com/StevenRudenko/ActionsContentView . I personally have not used it, so I can’t say that it will correspond to your specific use case with a box on the right, but it has a box on the left. Even then, you could start from there and should be able to build it to fit your use case.

+2
source

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; } 
+1
source

I would recommend using two overlapping fragments for this scenario. You can look at http://developer.android.com/guide/practices/tablets-and-handsets.html and http://developer.android.com/guide/components/fragments.html for tutorials.

If you have any specific requests, let me know.

0
source

All Articles