https://github.com/czl0325/zlpolygonview-android
类似六芒星的能力值图/雷达图,可自定义点数和值。Android版
https://github.com/czl0325/zlpolygonview-android
Last synced: about 2 months ago
JSON representation
类似六芒星的能力值图/雷达图,可自定义点数和值。Android版
- Host: GitHub
- URL: https://github.com/czl0325/zlpolygonview-android
- Owner: czl0325
- License: apache-2.0
- Created: 2018-11-08T08:30:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-20T09:13:10.000Z (over 6 years ago)
- Last Synced: 2025-04-15T05:46:42.076Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 268 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZLPolygonView-Android
类似六芒星的能力值图案,可自定义点数和值。Android版### 效果图

### 导入
```JAVA
implementation 'com.github.czl0325:zlpolygonview:1.0.2'
```### 参数
| 可配置参数 | 类型 | 作用 |
|------------------------|-----------|--------------------------------------------------------|
| mPolygonValues | List | 每个能力值的数值数组,介于0~1之间 |
| mTextLabels | List | 标签数组,没有默认显示“空” |
| InnerColor | color\|reference | 内部填充颜色的色值,默认为Color.CYAN |
| LineColor | color\|reference | 线条的颜色,默认为Color.GRAY |
| LineWidth | dimension | 线条宽度,默认为1 |
| EdgeNumber | integer | 分割线的数量,默认为4 |
| DotNumber | integer | 点数,默认为4 |### 用法
```html
```
```JAVA
polygonView = findViewById(R.id.polygonview);
List values = new ArrayList<>();
for (int i=0; i<4; i++) {
values.add((float) (Math.random()*50/100+0.5));
}
polygonView.setPolygonValues(values);
polygonView.setOnClickPolygonListeren(new ZLPolygonView.onClickPolygonListeren() {
@Override
public void onClickPolygon(MotionEvent event, int index) {
View rootView = LayoutInflater.from(MainActivity.this).inflate(R.layout.activity_main, null);new ValuePopupWindow(MainActivity.this).showAtLocation(rootView,
Gravity.TOP|Gravity.LEFT,
(int)event.getRawX(), (int)event.getRawY());
}
});
```