Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gpfduoduo/RadarScanView
android下自定义View之雷达扫描 The Radar (Scanning) View on Android 当扫描到对象的时候,通过水波纹的方式显示扫描到的对象,可以动态的随机添加,并且扫描到的对象是可以点击的……
https://github.com/gpfduoduo/RadarScanView
Last synced: 3 months ago
JSON representation
android下自定义View之雷达扫描 The Radar (Scanning) View on Android 当扫描到对象的时候,通过水波纹的方式显示扫描到的对象,可以动态的随机添加,并且扫描到的对象是可以点击的……
- Host: GitHub
- URL: https://github.com/gpfduoduo/RadarScanView
- Owner: gpfduoduo
- Created: 2015-08-19T12:10:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-22T04:19:13.000Z (almost 9 years ago)
- Last Synced: 2024-07-01T10:51:13.152Z (5 months ago)
- Language: Java
- Homepage:
- Size: 3.91 MB
- Stars: 618
- Watchers: 24
- Forks: 163
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RadarScanView
自定义View之雷达扫描## 原理
关键是使用SweepGradient进行扫描渲染
关键代码如下:```JAVA
Shader shader = new SweepGradient(centerX, centerY, Color.TRANSPARENT, tailColor);
mPaintRadar.setShader(shader);
```
然后旋转起来即可```JAVA
matrix.postRotate(start, centerX, centerY);
```
代码中包含了如何自定义一个View,怎样重写onMeasure、onSizeChanged、onDraw函数、自定义属性等等知识点## 效果图
![image](https://github.com/gpfduoduo/RadarScanView/blob/master/RadarScanView/gif/radar.gif "效果图")
## 添加动态显示效果
```JAVA
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
randomTextView.addKeyWord("彭丽媛");
randomTextView.addKeyWord("习近平");
randomTextView.show();
}
}, 2 * 1000);
```## 添加动态发现水波效果
![image](https://github.com/gpfduoduo/RadarScanView/blob/master/RadarScanView/gif/radarscan.gif "效果图")