Making a slidable view from top to down, similar t

2019-04-13 06:04发布

问题:

The idea I'm having is having a view that can be pulled down on top of the current view, with similar animation features like the one you can pull down from the top all the time, on Android Devices.

Here's an illustration:

The idea is to grab it and being able to pull it down on top of the other view, and then being able to interact with that view. To slide it up again, you should grab the bottom of the view (the grey area in the illustration) again, and then pull it up.

I haven't even worked with animations before but I found a lot of topics on that, while searching for solutions to my problem, including this: Slide down view in android but my impression is that, that is about making animations when the user isn't touching the phone.

What is the best way to do this? Is there a better way to do something very similar?

EDIT:

Here's the topic that made me find the solution: How to make an Android SlidingDrawer slide out from the left?

And here's the solution I used: SlidingDrawer Top-to-Bottom

回答1:

You could use a SlidingDrawer, this is a built in component into Android, but as far as I know it slides only from bottom - up.

If you a comfortable to modify your app design, then this could be an option for you.

However, on internet are some libraries of custom SlidingDrawer that lets you put the marker on any side of your screen, so you can drag it top-down, left-right, right-left.. any way you want.

Useful links:
How to make an Android SlidingDrawer slide out from the left?
SlidingDrawer Top-to-Bottom