Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sliding drawer looks like semi circle

Android provides the SlidingDrawer by default looks like below image -

Image http://www.gru.at/android/wp-content/uploads/2010/09/s_open.png

Can we customize this SlidingDrawer looks like semi-circle type with buttons included. For, example take a look at below image -

New Sliding Drawer

Anyone done the SlidingDrawer like above one. I've googled it. Didn't get any nice solution for this. Anyone has idea/example blog for this?

like image 791
Praveenkumar Avatar asked Nov 13 '22 03:11

Praveenkumar


1 Answers

So make sure you have Gimp and 9-Patch at the ready for a lot of trial and error...

Then what you wanna do is...

  1. Add suitable layout to hold buttons where the current ImageView Handle is, like Horizontal LinearLayout or RelativeLayout

  2. Cut the id of the current ImageView Handle and add it to this new Layout you just added

  3. add your buttons to the LinearLayout/RelativeLayout (you can test it now, the buttons and the handle should all slide open at the same time)

  4. Now add Button listeners for each of the buttons

  5. Set the SlidingDrawer to android:allowSingleTap = "false" (tit for tat, you cant have the single tap option anymore, just the slide)

  6. Use a ButtonSelector.xml to have different layouts for buttons be pressed or not pressed.

  7. This is the hard part. Edit the drawables for the buttons, and handle so that they will fit together nicely if the screen is huge, small, landscape, portrait. I recommend using 9-Patch in conjunction with Gimp.

  8. Pat yourself on the back because you now have a totally sweet custom sliding drawer.

Make sure you post pictures and state any problems or issues you ran into as I have never fully implemented this, but I did get to step 6 to make sure it was possible.

Last but not least, Good Luck...

like image 169
CommonKnowledge Avatar answered Nov 16 '22 03:11

CommonKnowledge