4

I'm working on a project that requires a button to only be pressed once a translucent screen has been slid up. This allows for access to the main button (Press Me, in the picture). I would like for the top screen to be translucent so a user can see the button behind it, but I would also like to have buttons (green buttons 1, 2, and 3) on the top screen. Are there any good tutorials on this? I have looked, but haven't found much that relates a whole lot. If you have any sugguestions please let me know. I'd also like to know how difficult this is since I'm new to Java/Android. Here's the illustration to give you a better idea of what I want:

enter image description here

This would work similar to how the iPhone has the screen that can be pulled down from the top, but this one is always down and can be moved upward. Let me know if you have any suggestions.

Thanks!

mkyong
  • 12,497
  • 12
  • 37
  • 56

2 Answers2

3

I have created something like you are trying to do. Sorry I can't post the code since it's part of the company I work for. However here is what I did.

I copied the SlidingDrawer.java source to my project and made sure it was first working as expected. I than started modifying it to slide from the top and not the bottom. Took me a little time but it was well worth the learning experience.

Good luck!

Jona
  • 13,325
  • 15
  • 86
  • 129
  • Can you tell me a little about how you made the drawer slide from the top? I have read that it's only possible for the drawer to slide from the bottom and sides. It's important that I use a sliding drawer and not a bunch of custom animation. I've seen some that allow a sliding drawer from the top, but they do not use the actual sliding drawer that the SDK provides. Thanks! – mkyong Feb 14 '12 at 06:10
  • Well, if you base it on the original source you should have something solid and very optimized. You will have to go part by part and start swapping the values to achieve top swiping. A great hint that helps figure it all is that this particular class supports the left and bottom swiping. Looking at the code will become obvious where they do left or bottom swiping. Based on that will give you an idea what needs changed to achieve top swiping. – Jona Feb 14 '12 at 17:52
3

I have try this demo for My requirement and it helps me a lot: Android-Slider Demo

Just Try it for your purpose and it will surly help you.

Enjoy. :)

Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188