{"id":13638937,"url":"https://github.com/Brioal/SwipeMenuDemo","last_synced_at":"2025-04-19T21:35:16.828Z","repository":{"id":106170866,"uuid":"65250675","full_name":"Brioal/SwipeMenuDemo","owner":"Brioal","description":"多达288种动画效果定制的侧滑菜单库","archived":false,"fork":false,"pushed_at":"2018-03-17T03:26:24.000Z","size":27331,"stargazers_count":784,"open_issues_count":8,"forks_count":203,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-08-03T01:13:39.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Brioal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-08-09T00:58:22.000Z","updated_at":"2024-04-06T12:52:25.000Z","dependencies_parsed_at":"2024-01-14T11:14:33.087Z","dependency_job_id":null,"html_url":"https://github.com/Brioal/SwipeMenuDemo","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brioal%2FSwipeMenuDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brioal%2FSwipeMenuDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brioal%2FSwipeMenuDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brioal%2FSwipeMenuDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Brioal","download_url":"https://codeload.github.com/Brioal/SwipeMenuDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223810226,"owners_count":17206718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:00:55.575Z","updated_at":"2024-11-09T09:30:27.059Z","avatar_url":"https://github.com/Brioal.png","language":"Java","readme":"## 效果演示:\n## 注意:因为 好几个同学都遇到了刷新不及时以及类似的问题,所以请暂时不要用这个库,我会在近期修复,下面放一个替代的库\n#### [SlidingMenu](https://github.com/jfeinstein10/SlidingMenu),造成的不便请大家谅解\n## 首先是实现效果的总览:\n![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/summary1.png)![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/summary2.png)\n## 然后是单独动画效果的演示:\n动画分类|演示图|动画分类|效果图\n:--|:--|:--|:--\n位移动画|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/1.gif)|缩放动画|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/2.gif)\n透明度动画|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/3.gif)|旋转动画|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/4.gif)\n全局图片沉浸|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/5.gif)|模糊背景|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/6.gif)\n动态模糊|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/7.gif)|反向动态模糊|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/8.gif)\n组合动画1|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/9.gif)|组合动画2|![这里写图片描述](https://github.com/Brioal/SwipeMenuDemo/blob/master/art/10.gif)\n### 好了,就演示这么多了,因为组合动画太多了,演示不完的\n### 简单计算一下:\n```\n\n(位移动画(3种)*缩放动画(2种)*透明动画(2种)*旋转动画(6种),图片背景效果(4种)=288(种),\n另外包括缩放,透明度,3D旋转,动态模糊都能设置范围,所以可定制的效果就更多了.\n\n```\n### 使用方法:\n### 用于测试的`Demo`上演示了很多效果,同时动态的显示了当前效果要进行的代码设置方法,同时还包含一些小提示,建议您先下个`Demo`先看看.[Demo下载](http://www.brioal.cn/apks/SwipeMenuDemo.apk)\n### `xml`布局文件中的使用方法:\n```\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003ccom.brioal.swipemenu.view.SwipeMenu\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:id=\"@+id/main_swipemenu\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.brioal.swipemenudemo.MainActivity\"\u003e\n\n    \u003cinclude layout=\"@layout/left_menu\"/\u003e\n\n    \u003cinclude layout=\"@layout/right_content\"/\u003e\n\n\u003c/com.brioal.swipemenu.view.SwipeMenu\u003e\n\n```\n### 布局文件非常简单,包含两个`xml`布局,上边的是菜单布局,下边的是内容布局\n### 如果是最简单的使用那么这样设置已经足够了,默认的是固定不动的滑动方式\n### 如果要对滑动的参数和效果进行定制,那么可以看一下资源文件中的设置(都有注释,理解起来不难)\n```\n\u003cdeclare-styleable name=\"SwipeMenu\"\u003e\n        \u003c!--动画的代码--\u003e\n        \u003cattr name=\"sm_type\" format=\"integer\"/\u003e\n        \u003c!--滑出菜单的范围--\u003e\n        \u003cattr name=\"sm_dragoffset\" format=\"dimension\"/\u003e\n        \u003c!--滑出菜单距边界的值--\u003e\n        \u003cattr name=\"sm_menuoffset\" format=\"dimension\"/\u003e\n        \u003c!--滑动开始的缩放值--\u003e\n        \u003cattr name=\"sm_startscale\" format=\"float\"/\u003e\n        \u003c!--滑动开始的alpha值--\u003e\n        \u003cattr name=\"sm_startalpha\" format=\"float\"/\u003e\n        \u003c!--滑动开始的3D旋转角度--\u003e\n        \u003cattr name=\"sm_start3dangle\" format=\"integer\"/\u003e\n    \u003c/declare-styleable\u003e\n```\n### 关于动画代码这里解释一下\n### 为了方便定制动画效果,用一个4位数字来表示不同的动画组合,个位代表的旋转动画效果序号,十位代表透明度动画效果,千位代表缩放动画效果,万位代表位移动画效果,各个位置的起始都是1,有几种动画效果上限就是多少.比如位移动画有三种,则万位的范围就为1~3,其他依次类推.\n#### 注:因为背景,模糊效果会引入多余的组件,所以只在需要的时候添加进去,故不包含在动画代码中,设置方式下面再说.\n### 再贴一个`xml`属性与代码的实现表格\n\n代码实现|xml实现|功能\n:--|:--|:--\n`void setStyleCode(int type)`|'sm_type`|设置动画效果代码\n`void setMenuOffset(int menuOffset)`|`sm_menuoffset`|设置拉出菜单距离右边界的距离\n`void setDragWipeOffset(int dragWipeOffset)`|`sm_dragoffset`|设置触发滑动的范围,为0则是全屏\n`void setStartScale(float minScale)`|`sm_startscale`|设置起始缩放\n`void setStartAlpha(float startAlpha)`|`sm_startalpha`|设置起始透明度\n`void setStart3DAngle(int start3DAngle)`|`sm_start3dangle`|设置起始3D旋转角度\n`void setFullColor(Activity activity, int headColor)`|无|设置全局颜色\n`void setBackImage(Activity activity, int backBitmap, int headColor)`|无|设置全局图片背景并沉浸\n`void setBlur(Activity activity, int backBitmap, int headColor, float blur)`|无|设置全局模糊背景并指定模糊程度\n`void setChangedBlur(Activity activity, int backBitmap, int headColor)`|无|设置全局动态模糊(范围默认0~25f)\n`void setReverseChangedBlur(Activity activity, int backBitmap, int headColor)`|无|设置反向动态模糊背景(范围默认0~25f)\n`void setChangedBlur(Activity activity, int backBitmap, int headColor, float startBlur, float endBlur)`|无|设置指定范围的动态模糊\n`void setOnMenuShowingListener(onSwipeProgressListener listener)`|无|设置滑动监听,回调获取菜单从隐藏到显示的进度,范围(0~1.0f)\n`void changeAllColor(int color)`|无|改变全局颜色(需要先设置全局颜色否则报错)\n`void isMenuShowing()`|无|返回当前菜单是否显示\n`void showMenu()`|无|显示菜单\n`void hideMenu()`|无|隐藏菜单\n\n## 提供的方法就这么多,也不难理解,这里再说一点注意事项\n### 1.默认是不设置全局背景或者颜色的,所以如果需要全局颜色沉浸和背景沉浸请做相关设置.两种沉浸都兼容到4.4\n### 2.全局颜色支持动态更换,全局图片背景不支持,当时想的是应该没有这种需求,当然如果有的话可以跟我反馈我会添加.\n### 3.旋转动画其实就一个3D旋转效果比较好,其他的都是瞎添的,如果要用除3D旋转之外的旋转效果建议和透明度动画一起使用,可防止卡顿(单独用中心旋转卡顿明显,毕竟绘图的代价摆在那)\n## 为了方便同学们对效果进行设置,我在演示`Demo`中添加了参数设置显示的效果,就在`RecyclerView`的第一个`Item`,并且是可以动态更改的,当前的效果需要如何设置参数全部在上面显示出来了.\n## 另外用`RecyclerView`来显示提示的另一个目的是演示滑动冲突的处理,默认的是菜单和内容都是可以处理横向纵向的滑动操作的,只有当滑动在靠近菜单内容交集点的时候才会触发滑动.当然也可以设置全屏滑动和设置触发的范围,具体方法查看上面表格内的方法,这里就不重复了.\n## 使用介绍就到这里了,下面介绍如何添加依赖库:\n## Step 1. Add the JitPack repository to your build file\n### Add it in your root build.gradle at the end of repositories:\n```\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url \"https://jitpack.io\" }\n\t\t}\n\t}\n\t\n\t\n```\n\n## Step 2. Add the dependency\n\n```\n\tdependencies {\n\t        compile 'com.github.Brioal:SwipeMenuDemo:1.5'\n\t}\n\t\n\t\n```\n## 或者可以下载`Demo`提取`module`添加\n\n## 另外说一点其他的,本人开学大四,喜欢`Android`开发,目前还没有确定的工作,如果您有推荐可以进入我的另外一个博客查看简历:[Brioal`s Blog](http://www.brioal.cn/wordpress/)\n## 如果觉得我写的东西多多少少有一点可取之处,可以点个star,多的话也能写到简历装一下是吧~~麻烦了\n## 大部分大学应该是不开`Android`开发的,在这里与所有自学`Android`的同学们共勉~自学不容易啊!!\n## 另外我建了个qq群,方便交流,欢迎各种大神,新手老手加入,群号码:`375276053`\n## 差点忘了,本库用到的一些代码片段来自网络,贴一下地址,感谢大神的代码:\n### [沉浸状态栏](https://github.com/laobie/StatusBarUtil)\n### [教你一分钟实现动态模糊效果](http://mp.weixin.qq.com/s?__biz=MzA5MzI3NjE2MA==\u0026mid=2650236619\u0026idx=1\u0026sn=7f4f97babcad9f62607e544efaf2d86e\u0026scene=23\u0026srcid=0809CmU7E9JVZ0ZIyCvG4nLh#rd)\n","funding_links":[],"categories":["抽屉菜单"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBrioal%2FSwipeMenuDemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBrioal%2FSwipeMenuDemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBrioal%2FSwipeMenuDemo/lists"}