像 SKOUT 这样的菜单和在 Android 中通过触摸从一个视图滑动到另一个视图 [英] Menu like SKOUT and Sliding from One View to Another by touch in Android

查看:19
本文介绍了像 SKOUT 这样的菜单和在 Android 中通过触摸从一个视图滑动到另一个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个像 FB 或 G+ 应用程序的滑动菜单,我从

解决方案

最简单的解决方案可能是使用 android-undergarment,基于项目自述文件,内置了边框滑动:

<块引用>

用户还可以通过从屏幕左侧的边框滑动来打开抽屉并从右侧执行相同操作来关闭抽屉来控制抽屉.如果你想阻止这个触摸功能,你可以调用 setDrawerEnabled(false).

I want to implement a sliding Menu like FB or G+ app and I have found some sample code from FB Menu Demo and https://github.com/jfeinstein10/SlidingMenu

These are good to begin with, But I need something extra from them. Like here it works only on the click of the menu button but I want to move it by gestures as well. I want to have the behavior that there is a center view and on moving that center towards the right, one view will appear and on moving that towards left, the menu will appear. Say there are three views A,B,C and when I swipe C towards left then A appear and when I swipe C towards right then B appear. C is in the middle of A and B.

1.Middle view moves towards right

Move towards right

2.Move the middle view towards left side

Move towards left

Now my question is: What are the best practices to develop the views like that. I have heard from someone that I should use fragments and View pager as well. So how can I develop this? Is there any sample implementation done by anyone ? Any help and suggestions are appreciated.

For reference see this app which uses this type of sliding b/w views Skout app

解决方案

The simplest solution may be to use android-undergarment, which has bezel swiping built in, based on the project README:

The user will also be able to control the drawer by bezel swiping from the left side of the screen to open the drawer and doing the same from the right to close it. If you want to prevent this touch functionality, you can call setDrawerEnabled(false).

这篇关于像 SKOUT 这样的菜单和在 Android 中通过触摸从一个视图滑动到另一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆