Velizar Hristov
Velizar Hristov

Reputation: 720

Android sliding between layouts as the ImageButton is held

I have an image and I've included it as an ImageButton (but ImageView would probably be fine as well). It looks like soemthing that is to be dragged up, in order to switch to the Settings interface. I've been researching this for days, looking at lots of pages on the question (many of them concerning ViewPager), but none of them was clear - some of them say "use class X", others just assume I know tons of things I don't. There was a few ones that actually worked, but they were horizontal. The vertical ones I found were incomprehensible and unexplained. Can anyone explain it in an understandable manner, please?

Basically what I need is:

Upvotes: 1

Views: 243

Answers (1)

Aaron
Aaron

Reputation: 7100

Android has a built-in widget called a SlidingDrawer to do just that. In your case, the image at the bottom of layout.xml would be considered the "handle," and layout2.xml would be the "content." The handle can be any type of widget, be it a Button, ImageButton, ImageView, etc. If you touch or slide the handle, it will slide to cover the screen as you described.

The Android documentation in the link above explains it pretty well, but I can try to explain a bit more if you have specific questions

Upvotes: 1

Related Questions