{"id":13645686,"url":"https://github.com/fashare2015/HoverView","last_synced_at":"2025-04-21T14:32:02.973Z","repository":{"id":202209237,"uuid":"76279124","full_name":"fashare2015/HoverView","owner":"fashare2015","description":"一个底部抽屉。它可以悬停在中间，随着滑动自然过度到全屏","archived":false,"fork":false,"pushed_at":"2018-02-02T10:37:41.000Z","size":114,"stargazers_count":194,"open_issues_count":3,"forks_count":22,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-09T18:43:23.223Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/fashare2015.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}},"created_at":"2016-12-12T17:23:21.000Z","updated_at":"2024-09-21T13:51:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"9415f849-d399-4c6f-8924-b4c8937d783b","html_url":"https://github.com/fashare2015/HoverView","commit_stats":null,"previous_names":["fashare2015/hoverview"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fashare2015%2FHoverView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fashare2015%2FHoverView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fashare2015%2FHoverView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fashare2015%2FHoverView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fashare2015","download_url":"https://codeload.github.com/fashare2015/HoverView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070253,"owners_count":21369843,"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:02:39.699Z","updated_at":"2025-04-21T14:32:02.587Z","avatar_url":"https://github.com/fashare2015.png","language":"Java","readme":"# HoverView\n一直觉得知乎的交互体验是很好的，这次山寨了一把。\n这是一个底部抽屉，类似知乎收藏夹。它可以悬停在中间，随着滑动自然过渡到全屏。\n它是仿照`support`包里的`DrawLayout`和`NavigationView`设计的。\n\u003cbr/\u003e\n\n# 效果图\n知乎收藏夹：\n\n- 可以悬停在中间\n- 可以滑动到全屏\n- 过渡十分流畅，纵享丝滑\n\n![这里写图片描述](http://img.blog.csdn.net/20161214212420754?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYTE1MzYxNDEzMQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\n\u003cbr/\u003e\n我的 HoverView :\n\n- 可以悬停在中间\n- 可以滑动到全屏\n- 过渡尚可，没有知乎的流畅\n\n![这里写图片描述](http://img.blog.csdn.net/20161214213925928?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYTE1MzYxNDEzMQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\u003cbr/\u003e\n\n# CSDN链接\nhttp://blog.csdn.net/a153614131/article/details/53647831\n\u003cbr/\u003e\n\n# 特点及使用场景\n底部抽屉，可以悬停、也可以全屏展示。适用于：\n\n- 淘宝购物车\n- 收藏夹\n- 分享框\n- ...\n\n\u003cbr/\u003e\n\n# Gradle 依赖\n最新版本：1.0.2\n```gradle\n// 1. Add it in your root build.gradle at the end of repositories:\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n\n// 2. Add the dependency in your app/build.gradle\ndependencies {\n    compile 'com.github.fashare2015:HoverView:最新版本'\n}\n```\n\u003cbr/\u003e\n\n# 使用方式\n## 布局结构\n类似`support`包里的`DrawLayout`和`NavigationView`的关系。这里有两个`View`:\n\n- `HoverViewContainer`: 容器，对应`DrawLayout`\n- `HoverView`: 悬停抽屉，对应`NavigationView`\n\n```xml\n\u003ccom.fashare.hover_view.HoverViewContainer\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"@android:color/darker_gray\"\u003e\n\n    // 原本的 rootView\n    ...\n\n    \u003ccom.fashare.hover_view.HoverView\n        android:id=\"@+id/hv\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\"\n        app:mTopFill=\"0.0\"\n        app:mTopHover=\"0.5\"\u003e\n\n        // HoverView 的内容\n        ...\n\n    \u003c/com.fashare.hover_view.HoverView\u003e\n\n\u003c/com.fashare.hover_view.HoverViewContainer\u003e \n```\n\u003cbr/\u003e\n\n## HoverView 属性\n它有两个属性，描述 `HoverView.getTop()`占父容器的比例（Height 为父容器高度）：\n\n- app:mTopFill=\"0.0\" 全屏时，距顶部 0.0Height（默认）\n- app:mTopHover=\"0.5\" 悬停时，距顶部 0.5Height\n\u003cbr/\u003e\n\n## 状态（高度）切换\n```java\n// 状态定义\npublic enum ViewState {\n    FILL,       // 全屏\n    HOVER,      // 半空悬停\n    CLOSE;      // 关闭: 完全藏在屏幕底部\n}\n\n// 状态切换 —— 类似 View.setVisibility();\nmHoverView.changeState(ViewState.HOVER);   // 打开至 \"悬停\" 状态\nmHoverView.changeState(ViewState.FILL);    // 打开至 \"全屏\" 状态\nmHoverView.changeState(ViewState.CLOSE);   // 切换至 \"关闭\" 状态\n```\n\u003cbr/\u003e\n\n# 类图\n![这里写图片描述](http://img.blog.csdn.net/20161214221551601?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYTE1MzYxNDEzMQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\n\u003cbr/\u003e\n\n# 最后\n使用愉快～\n\n\n","funding_links":[],"categories":["其他"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffashare2015%2FHoverView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffashare2015%2FHoverView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffashare2015%2FHoverView/lists"}