{"id":15033555,"url":"https://github.com/razerdp/animatedpieview","last_synced_at":"2025-05-16T15:08:09.212Z","repository":{"id":45695856,"uuid":"109812168","full_name":"razerdp/AnimatedPieView","owner":"razerdp","description":"// 一个好吃的甜甜圈？","archived":false,"fork":false,"pushed_at":"2020-11-02T05:37:09.000Z","size":11106,"stargazers_count":1315,"open_issues_count":8,"forks_count":179,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-10T17:24:35.137Z","etag":null,"topics":["androidviews","jcenter","pie-chart","ring-chart","widget"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/razerdp.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}},"created_at":"2017-11-07T09:11:48.000Z","updated_at":"2025-04-09T05:28:10.000Z","dependencies_parsed_at":"2022-07-18T06:47:01.785Z","dependency_job_id":null,"html_url":"https://github.com/razerdp/AnimatedPieView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razerdp%2FAnimatedPieView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razerdp%2FAnimatedPieView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razerdp%2FAnimatedPieView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razerdp%2FAnimatedPieView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/razerdp","download_url":"https://codeload.github.com/razerdp/AnimatedPieView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"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":["androidviews","jcenter","pie-chart","ring-chart","widget"],"created_at":"2024-09-24T20:21:41.417Z","updated_at":"2025-05-16T15:08:04.197Z","avatar_url":"https://github.com/razerdp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"AnimatedPieView\n---\n**一个好吃的甜甜圈？请问客官要啥口味捏-V-**\n \n[**English Doc**](https://github.com/razerdp/AnimatedPieView/blob/master/README_EN.md)\n\n[![jcenter](https://api.bintray.com/packages/razerdp/maven/AnimatedPieView/images/download.svg)](https://bintray.com/razerdp/maven/AnimatedPieView/_latestVersion)\n[![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/razerdp/AnimatedPieView/blob/master/LICENSE)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AnimatedPieView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6507)\n[![Api](https://img.shields.io/badge/Api-14%2B-green.svg)](https://img.shields.io/badge/Api-14%2B-green.svg)\n[![Author](https://img.shields.io/badge/Author-razerdp-blue.svg)](https://github.com/razerdp) \n\n开发进度 （更新日志-\u003e[日志](https://github.com/razerdp/AnimatedPieView/blob/master/UPDATE_LOG.md)）\n---\n\n  \u003e 如果您有别的需求，可以提交您的issue哦，当然，也可以直接修改源码-V-\n\n  * ~~支持TypeFace~~\n  * ~~点选文字或图表选中甜甜圈~~\n  * ~~增加默认选中支持~~\n  * ~~增加图例支持~~\n  * ~~增加删除数据的方法~~\n  * ~~增加描述标签支持~~\n  * ~~项目优化/重构，1.2.0发布~~\n  * ~~允许alpha突出选中的甜甜圈~~\n  * ~~允许甜甜圈之间含有间隔~~\n  * ~~文字自适应点击动画位置~~\n  * ~~文字描述动画~~\n  * ~~有文字描述的甜甜圈~~\n  * ~~点击事件回调的甜甜圈~~\n  * ~~点击动画的甜甜圈~~\n  * ~~可以点击的甜甜圈~~\n  * ~~可以变成大饼的甜甜圈~~\n  * ~~动画长大的甜甜圈~~\n\n主要功能\n---\n\n| 描述        | 方法    |  预览  |\n| --------   | :-----   | ---- |\n| 动画生长        | --      |   ![pie_animation](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_animation.gif)    |\n| 饼图/甜甜圈转换        | strokeMode(boolean)      |   ![pie_switch](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_switch.gif)    |\n| 角度间隙       | splitAngle(float)      |   ![pie_split_angle](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_split_angle.gif)    |\n| 绘制文字       | drawText(true)      |   ![pie_with_text](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_with_text.gif)    |\n| 点击效果       | canTouch(true) / selectListener()    |   ![pie_click_effect](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_click_effect.gif)    |\n| 焦点甜甜圈效果 (反向)      | focusAlphaType(\u003cbr\u003eAnimatedPieViewConfig.FOCUS_WITH_ALPHA_REV,150\u003cbr\u003e)    |   ![pie_click_with_focus_alpha_type_rev](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_click_with_focus_alpha_type_rev.gif)    |\n| 焦点甜甜圈效果       | focusAlphaType(\u003cbr\u003eAnimatedPieViewConfig.FOCUS_WITH_ALPHA,150\u003cbr\u003e)    |   ![pie_click_with_focus_alpha_type](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_click_with_focus_alpha_type.gif)    |\n| 甜甜圈标签       | IPieInfo.PieOption    |   ![pie_option](https://github.com/razerdp/AnimatedPieView/blob/master/art/pie_option.png)    |\n\n依赖\n---\n\n添加依赖（请把{latestVersion}替换成上面的jcenter标签所示版本）\n```xml\n\tdependencies {\n\t        implementation 'com.github.razerdp:AnimatedPieView:{latestVersion}'\n\t}\n```\n\n基本使用方式（简单的超乎想像）\n---\n\n**step 1：定义任意类实现IPieInfo接口（如果懒，可以使用SimplePieInfo）**\n\n```java\npublic class Test implements IPieInfo {\n    @Override\n    public float getValue() {\n        //这个数值将会决定其所占有的饼图百分比\n        return 0.5f;\n    }\n\n    @Override\n    public int getColor() {\n        //该段甜甜圈的颜色，请返回@colorInt，不要返回@colorRes\n        return Color.WHITE;\n    }\n\n    @Override\n    public String getDesc() {\n        //描述文字，可不返回\n        return \"这是一个测试\";\n    }\n    \n    @Nullable\n    @Override\n    public PieOption getPieOpeion() {\n       //一些别的设置，比如标签\n       return mPieOption;\n    }\n}\n```\n\n**step 2：定义config并配置就可以了**\n\n\n```java\nAnimatedPieView mAnimatedPieView = findViewById(R.id.animatedPieView);\nAnimatedPieViewConfig config = new AnimatedPieViewConfig();\nconfig.startAngle(-90)// 起始角度偏移\n      .addData(new SimplePieInfo(30, getColor(\"FFC5FF8C\"), \"这是第一段\"))//数据（实现IPieInfo接口的bean）\n      .addData(new SimplePieInfo(18.0f, getColor(\"FFFFD28C\"), \"这是第二段\"))\n      ...(尽管addData吧)\n      .duration(2000);// 持续时间\n                \n// 以下两句可以直接用 mAnimatedPieView.start(config); 解决，功能一致\nmAnimatedPieView.applyConfig(config);\nmAnimatedPieView.start();\n        \n```\n\n进阶用法（所有配置都在config，and...相信我，我提供大多数配置，但日常用到的，其实不多哈哈）\n---\n\n```java\nAnimatedPieViewConfig mConfig=mAnimatedPieView.getConfig();\nmConfig.animOnTouch(true)// 点击事件是否播放浮现动画/回退动画（默认true）\n       .addData(IPieInfo info, boolean autoDesc)// 添加数据，autoDesc：是否自动补充描述？（百分比）\n       .floatExpandAngle(15f)// 点击后圆弧/扇形扩展的角度\n       .floatShadowRadius(18f)// 点击后的阴影扩散范围\n       .floatUpDuration(500)// 点击浮现动画时间\n       .floatDownDuration(500)// 上一个浮现的圆弧回退的动画时间\n       .floatExpandSize(15)// 点击后扇形放大数值,，只对饼图有效\n       .strokeMode(true)// 是否只画圆弧【甜甜圈哈哈】，否则画扇形（默认true）\n       .strokeWidth(15)// 圆弧（甜甜圈）宽度\n       .duration(2500)// 动画时间\n       .startAngle(-90f)// 开始的角度\n       .selectListener(new OnPieSelectListener\u003cIPieInfo\u003e())//点击事件\n       .drawText(true)// 是否绘制文字描述\n       .textSize(12)// 绘制的文字大小\n       .textMargin(8)// 绘制文字与导航线的距离\n       .autoSize(true)// 自动测量甜甜圈半径\n       .pieRadius(100)// 甜甜圈半径\n       .pieRadiusRatio(0.8f)// 甜甜圈半径占比\n       .guidePointRadius(2)// 设置描述文字的开始小点的大小\n       .guideLineWidth(4)// 设置描述文字的指示线宽度\n       .guideLineMarginStart(8)// 设置描述文字的指示线开始距离外圆半径的大小\n       .textGravity(AnimatedPieViewConfig.ABOVE)// 设置描述文字方向 【\n            -AnimatedPieViewConfig.ABOVE：文字将会在导航线上方绘制\n            -AnimatedPieViewConfig.BELOW：文字在导航线下方绘制\n            -AnimatedPieViewConfig.ALIGN：文字与导航线对齐\n            -AnimatedPieViewConfig.ECTOPIC：文字在1、2象限部分绘制在线的上方，在3、4象限绘制在线的下方\n       】\n       .canTouch(true)// 是否允许甜甜圈点击放大\n       .typeFae(TypeFace)// 字体样式\n       .splitAngle(1)// 甜甜圈间隙角度\n       .focusAlphaType(AnimatedPieViewConfig.FOCUS_WITH_ALPHA_REV,150)// 焦点甜甜圈的alpha表现形态及alpha削减值\n       .interpolator(new DecelerateInterpolator())// 动画插值器\n       .focusAlpha(150) // 选中的/或者非选中的甜甜圈的alpha值（跟focusAlphaType挂钩）\n       .legendsWith((ViewGroup) findViewById(R.id.ll_legends), new OnPieLegendBindListener\u003cBasePieLegendsView\u003e() {\n                                @Override\n                                public BasePieLegendsView onCreateLegendView(int position, IPieInfo info) {\n                                    return position % 2 == 0 ?\n                                            DefaultPieLegendsView.newInstance(MainActivity.this)\n                                            : DefaultCirclePieLegendsView.newInstance(MainActivity.this);\n                                }\n\n                                @Override\n                                public boolean onAddView(ViewGroup parent, BasePieLegendsView view) {\n                                    return false;\n                                }\n                            }); //图例支持\n```\n\n---\n\n更多配置：\n-----\n\n在IPieInfo中，你可以配置`PieOption`以扩展每个甜甜圈的行为\n```java\n    @Nullable\n    @Override\n    public PieOption getPieOption() {\n        return new PieOption()\n                .setDefaultSelected(true) // 默认选中\n                .setIconHeight(50) // 图标的高度\n                .setIconWidth(50) //图标宽度\n                .setIconScaledHeight(0.5f) // 图标高度缩放\n                .setIconScaledWidth(0.5f) // 图标宽度缩放\n                .setLabelIcon(bitmap) // 图标资源\n                .setLabelPadding(5) // 图标与文字的距离\n                .setLabelPosition(PieOption.NEAR_PIE); // 图标在甜甜圈内侧\n    }\n```\n\n打赏（看在我那么努力维护的份上。。。给个零食呗~）\n---\n\n| 微信 |支付宝 | \n| ---- | ---- | \n| ![](https://github.com/razerdp/FriendCircle/blob/master/wechat.png)      | ![](https://github.com/razerdp/FriendCircle/blob/master/alipay.png) |\n\n\n控件思路【按思路顺序更新】\n---\n\n [一起弄个甜甜圈吧](https://github.com/razerdp/Article/blob/master/%E4%B8%80%E8%B5%B7%E6%92%B8%E4%B8%AA%E7%94%9C%E7%94%9C%E5%9C%88.md)\n\n\nLICENSE\n---\n\n[Apache-2.0](https://github.com/razerdp/AnimatedPieView/blob/master/LICENSE)\n   \n   \n\n   \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frazerdp%2Fanimatedpieview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frazerdp%2Fanimatedpieview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frazerdp%2Fanimatedpieview/lists"}