Making a slidable view from top to down, similar to the one in Android

眉间皱痕 提交于 2019-12-06 11:50:25

问题


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



来源:https://stackoverflow.com/questions/11863343/making-a-slidable-view-from-top-to-down-similar-to-the-one-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!