{"id":19765750,"url":"https://github.com/xuexiangjys/xfloatview","last_synced_at":"2026-03-06T02:31:39.069Z","repository":{"id":101672144,"uuid":"148579417","full_name":"xuexiangjys/XFloatView","owner":"xuexiangjys","description":"一个简易的悬浮窗实现方案","archived":false,"fork":false,"pushed_at":"2023-12-15T05:36:52.000Z","size":3337,"stargazers_count":66,"open_issues_count":1,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-02-29T16:32:00.314Z","etag":null,"topics":["android","android-ui","x-library","xui"],"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/xuexiangjys.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":"2018-09-13T03:55:32.000Z","updated_at":"2024-01-06T16:47:48.000Z","dependencies_parsed_at":"2023-06-07T16:45:23.995Z","dependency_job_id":null,"html_url":"https://github.com/xuexiangjys/XFloatView","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuexiangjys%2FXFloatView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuexiangjys%2FXFloatView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuexiangjys%2FXFloatView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuexiangjys%2FXFloatView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuexiangjys","download_url":"https://codeload.github.com/xuexiangjys/XFloatView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224214875,"owners_count":17274700,"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":["android","android-ui","x-library","xui"],"created_at":"2024-11-12T04:19:18.922Z","updated_at":"2026-03-06T02:31:39.029Z","avatar_url":"https://github.com/xuexiangjys.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XFloatView\n[![xfv][xfvsvg]][xfv]  [![api][apisvg]][api]\n\n一个简易的悬浮窗实现方案\n\n## 关于我\n\n[![github](https://img.shields.io/badge/GitHub-xuexiangjys-blue.svg)](https://github.com/xuexiangjys)   [![csdn](https://img.shields.io/badge/CSDN-xuexiangjys-green.svg)](http://blog.csdn.net/xuexiangjys)\n\n## 特征\n\n* 支持自定义布局的悬浮窗。\n\n* 支持自定义拖动事件、点击事件。\n\n* 支持悬浮窗自动吸附效果。\n\n* 支持初始化悬浮窗的位置。\n\n* 支持悬浮窗翻转吸附。\n\n--------\n\n## 1、演示（请star支持）\n\n### 1.1、Demo演示动画\n\n![][demo-gif]\n\n### 1.2、Demo下载\n\n[![downloads][download-svg]][download-url]\n\n![][download-img]\n\n## 2、如何使用\n\n目前支持主流开发工具AndroidStudio的使用，直接配置build.gradle，增加依赖即可.\n\n### 2.1、Android Studio导入方法，添加Gradle依赖\n\n1.先在项目根目录的 build.gradle 的 repositories 添加:\n\n```\nallprojects {\n     repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\n\n2.然后在dependencies添加:\n\n```\ndependencies {\n  ...\n  implementation 'com.github.xuexiangjys:XFloatView:1.0.1'\n}\n```\n\n### 2.2、继承XFloatView,实现自定义窗体\n\n主要需要实现如下抽象方法：\n\n```\n/**\n * @return 获取根布局的ID\n */\nprotected abstract int getLayoutId();\n\n/**\n * @return 能否移动或者触摸响应\n */\nprotected abstract boolean canMoveOrTouch();\n\n/**\n * 初始化悬浮控件\n */\nprotected abstract void initFloatView();\n\n/**\n * 初始化监听\n */\nprotected abstract void initListener();\n\n/**\n * @return 设置悬浮框是否吸附在屏幕边缘\n */\nprotected abstract boolean isAdsorbView();\n```\n\n[点击查看示例代码](https://github.com/xuexiangjys/XFloatView/tree/master/app/src/main/java/com/xuexiang/xfloatviewdemo/widget)\n\n### 2.3、悬浮窗的权限申请\n\n```\nFloatWindowPermission.getInstance().applyFloatWindowPermission(getContext());\n```\n\n## 联系方式\n\n[![](https://img.shields.io/badge/点击一键加入QQ交流群-602082750-blue.svg)](http://shang.qq.com/wpa/qunwpa?idkey=9922861ef85c19f1575aecea0e8680f60d9386080a97ed310c971ae074998887)\n\n![](https://github.com/xuexiangjys/XPage/blob/master/img/qq_group.jpg)\n\n\n[xfvsvg]: https://img.shields.io/badge/XFloatView-v1.0.1-brightgreen.svg\n[xfv]: https://github.com/xuexiangjys/XFloatView\n[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg\n[api]: https://android-arsenal.com/api?level=14\n\n\n[demo-gif]: https://github.com/xuexiangjys/XFloatView/blob/master/img/demo.gif\n[download-svg]: https://img.shields.io/badge/downloads-1.5M-blue.svg\n[download-url]: https://github.com/xuexiangjys/XFloatView/blob/master/apk/xfloatview_demo_1.0.apk?raw=true\n[download-img]: https://github.com/xuexiangjys/XFloatView/blob/master/img/download.png","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuexiangjys%2Fxfloatview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuexiangjys%2Fxfloatview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuexiangjys%2Fxfloatview/lists"}