{"id":18565069,"url":"https://github.com/jenly1314/dragpolygonview","last_synced_at":"2025-04-10T04:32:15.948Z","repository":{"id":72501267,"uuid":"305323502","full_name":"jenly1314/DragPolygonView","owner":"jenly1314","description":":star: 一个支持可拖动多边形，可拖动多边形的角改变其形状的任意多边形控件","archived":false,"fork":false,"pushed_at":"2024-06-20T10:27:45.000Z","size":5979,"stargazers_count":33,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T16:11:14.533Z","etag":null,"topics":["android","drag-polygon-view","draw-polygons","polygon","polygons"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenly1314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-19T09:00:26.000Z","updated_at":"2024-09-14T03:00:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb06ef04-e772-4845-80ff-1ebee12ab2c3","html_url":"https://github.com/jenly1314/DragPolygonView","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/jenly1314%2FDragPolygonView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FDragPolygonView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FDragPolygonView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenly1314%2FDragPolygonView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenly1314","download_url":"https://codeload.github.com/jenly1314/DragPolygonView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248157558,"owners_count":21057035,"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","drag-polygon-view","draw-polygons","polygon","polygons"],"created_at":"2024-11-06T22:17:35.642Z","updated_at":"2025-04-10T04:32:14.838Z","avatar_url":"https://github.com/jenly1314.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DragPolygonView\n\n[![Download](https://img.shields.io/badge/download-App-blue.svg)](https://raw.githubusercontent.com/jenly1314/DragPolygonView/master/app/release/app-release.apk)\n[![JCenter](https://img.shields.io/badge/JCenter-1.0.2-46C018.svg)](https://bintray.com/beta/#/jenly/maven/dragpolygonview)\n[![JitPack](https://jitpack.io/v/jenly1314/DragPolygonView.svg)](https://jitpack.io/#jenly1314/DragPolygonView)\n[![CI](https://travis-ci.org/jenly1314/DragPolygonView.svg?branch=master)](https://travis-ci.org/jenly1314/DragPolygonView)\n[![CircleCI](https://circleci.com/gh/jenly1314/DragPolygonView.svg?style=svg)](https://circleci.com/gh/jenly1314/DragPolygonView)\n[![API](https://img.shields.io/badge/API-21%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=21)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php)\n\nDragPolygonView for Android 是一个支持可拖动多边形，支持通过拖拽多边形的角改变其形状的任意多边形控件。\n\n## 特性说明\n- [x] 支持添加多个任意多边形\n- [x] 支持通过触摸多边形拖动改变其位置\n- [x] 支持通过触摸多边形的角改变其形状\n- [x] 支持点击、长按、改变等事件监听\n- [x] 支持多边形单选或多选模式\n\n## Gif 展示\n![Image](GIF.gif)\n\n\u003e 你也可以直接下载 [演示App](https://raw.githubusercontent.com/jenly1314/DragPolygonView/master/app/release/app-release.apk) 体验效果\n\n## 引入\n\n### Gradle:\n\n1. 在Project的 **build.gradle** 或 **setting.gradle** 中添加远程仓库\n\n    ```gradle\n    repositories {\n        //...\n        mavenCentral()\n        maven { url 'https://jitpack.io' }\n    }\n    ```\n\n2. 在Module的 **build.gradle** 里面添加引入依赖项\n\n    ```gradle\n    implementation 'com.github.jenly1314:DragPolygonView:1.0.2'\n    ```\n\n## 使用\n\n### DragPolygonView 自定义属性说明\n\n| 属性 | 值类型 | 默认值 | 说明 |\n| :------| :------ | :------ | :------ |\n| dpvStrokeWidth | float | 4 | 画笔描边的宽度 |\n| dpvPointStrokeWidthMultiplier | float | 1.0 | 绘制多边形点坐标时基于画笔描边的宽度倍数 |\n| dpvPointNormalColor | color |\u003cfont color=#E5574C\u003e#FFE5574C\u003c/font\u003e| 多边形点的颜色 |\n| dpvPointPressedColor | color | | 多边形点按下状态时的颜色 |\n| dpvPointSelectedColor | color | | 多边形点选中状态时的颜色 |\n| dpvLineNormalColor | color |\u003cfont color=#E5574C\u003e#FFE5574C\u003c/font\u003e| 多边形边线的颜色 |\n| dpvLinePressedColor | color | | 多边形边线按下状态的颜色 |\n| dpvLineSelectedColor | color | | 多边形边线选中状态的颜色 |\n| dpvFillNormalColor | color |\u003cfont color=#E5574C\u003e#3FE5574C\u003c/font\u003e| 多边形填充的颜色 |\n| dpvFillPressedColor | color |\u003cfont color=#E5574C\u003e#7FE5574C\u003c/font\u003e| 多边形填充按下状态时的颜色 |\n| dpvFillSelectedColor | color |\u003cfont color=#E5574C\u003e#AFE5574C\u003c/font\u003e| 多边形填充选中状态时的颜色 |\n| dpvAllowableOffsets | dimension | 16dp | 触点允许的误差偏移量 |\n| dpvDragEnabled | boolean | true | 是否启用拖动多边形 |\n| dpvChangeAngleEnabled | boolean | true | 是否启用多边形的各个角的角度支持可变 |\n| dpvMultipleSelection | boolean | false | 是否是多选模式，默认：单选模式 |\n| dpvClickToggleSelected | boolean | false | 是否点击就切换多边形的选中状态 |\n| dpvAllowDragOutView | boolean | false | 是否允许多边形拖出视图范围 |\n| dpvTextSize | dimension | 16sp | 是否允许多边形拖出视图范围 |\n| dpvTextNormalColor | color |\u003cfont color=#E5574C\u003e#FFE5574C\u003c/font\u003e| 多边形文本的颜色 |\n| dpvTextPressedColor | color | | 多边形文本按下状态的颜色 |\n| dpvTextSelectedColor | color | | 多边形文本选中状态的颜色 |\n| dpvShowText | boolean | true | 是否显示多边形的文本 |\n| dpvFakeBoldText | boolean | false | 多边形Text的字体是否为粗体 |\n\n### 示例\n\n布局示例\n```Xml\n    \u003ccom.king.view.dragpolygonview.DragPolygonView\n        android:id=\"@+id/dragPolygonView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"/\u003e\n```\n\n代码示例\n```Java\n    //添加多边形\n    dragPolygonView.addPolygon(Polygon polygon);\n    //添加多边形(多边形的各个点)\n    dragPolygonView.addPolygon(PointF... points);\n    //根据位置将多边形改为选中状态\n    dragPolygonView.setPolygonSelected(int position);\n    //改变监听\n    dragPolygonView.setOnChangeListener(OnChangeListener listener);\n    //点击监听\n    dragPolygonView.setOnPolygonClickListener(OnPolygonClickListener listener);\n    //长按监听\n    dragPolygonView.setOnPolygonLongClickListener(OnPolygonLongClickListener listener)\n\n```\n更多使用详情，请查看[app](app)中的源码使用示例或直接查看 [API帮助文档](https://jitpack.io/com/github/jenly1314/DragPolygonView/latest/javadoc/)\n\n## 版本记录\n\n#### v1.0.2：2020-12-2\n* Polygon新增Text属性（可显示在多边形中间）\n\n#### v1.0.1：2020-10-23\n* 新增点击和长按事件\n* 新增选中相关状态\n\n#### v1.0.0：2020-10-19\n*  DragPolygonView初始版本\n\n## 赞赏\n如果您喜欢DragPolygonView，或感觉DragPolygonView帮助到了您，可以点右上角“Star”支持一下，您的支持就是我的动力，谢谢 :smiley:\n\u003cp\u003e您也可以扫描下面的二维码，请作者喝杯咖啡 :coffee:\n\n\u003cdiv\u003e\n   \u003cimg src=\"https://jenly1314.github.io/image/page/rewardcode.png\"\u003e\n\u003c/div\u003e\n\n## 关于我\n\n| 我的博客                                                                                | GitHub                                                                                  | Gitee                                                                                  | CSDN                                                                                 | 博客园                                                                            |\n|:------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------|\n| \u003ca title=\"我的博客\" href=\"https://jenly1314.github.io\" target=\"_blank\"\u003eJenly's Blog\u003c/a\u003e | \u003ca title=\"GitHub开源项目\" href=\"https://github.com/jenly1314\" target=\"_blank\"\u003ejenly1314\u003c/a\u003e | \u003ca title=\"Gitee开源项目\" href=\"https://gitee.com/jenly1314\" target=\"_blank\"\u003ejenly1314\u003c/a\u003e  | \u003ca title=\"CSDN博客\" href=\"http://blog.csdn.net/jenly121\" target=\"_blank\"\u003ejenly121\u003c/a\u003e  | \u003ca title=\"博客园\" href=\"https://www.cnblogs.com/jenly\" target=\"_blank\"\u003ejenly\u003c/a\u003e  |\n\n## 联系我\n\n| 微信公众号        | Gmail邮箱                                                                          | QQ邮箱                                                                              | QQ群                                                                                                                       | QQ群                                                                                                                       |\n|:-------------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------|\n| [Jenly666](http://weixin.qq.com/r/wzpWTuPEQL4-ract92-R) | \u003ca title=\"给我发邮件\" href=\"mailto:jenly1314@gmail.com\" target=\"_blank\"\u003ejenly1314\u003c/a\u003e | \u003ca title=\"给我发邮件\" href=\"mailto:jenly1314@vip.qq.com\" target=\"_blank\"\u003ejenly1314\u003c/a\u003e | \u003ca title=\"点击加入QQ群\" href=\"https://qm.qq.com/cgi-bin/qm/qr?k=6_RukjAhwjAdDHEk2G7nph-o8fBFFzZz\" target=\"_blank\"\u003e20867961\u003c/a\u003e | \u003ca title=\"点击加入QQ群\" href=\"https://qm.qq.com/cgi-bin/qm/qr?k=Z9pobM8bzAW7tM_8xC31W8IcbIl0A-zT\" target=\"_blank\"\u003e64020761\u003c/a\u003e |\n\n\u003cdiv\u003e\n   \u003cimg src=\"https://jenly1314.github.io/image/page/footer.png\"\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenly1314%2Fdragpolygonview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenly1314%2Fdragpolygonview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenly1314%2Fdragpolygonview/lists"}