Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SwipeCaptcha

> 编程语言
Open source

Swipe captcha of Android platform. Android 平台的滑动验证码。

706 stars0 likes2 views
WebsiteGitHub

About

Swipe captcha of Android platform. Android 平台的滑动验证码。

-SwipeCaptcha

Swipe captcha of Android platform。 Android 平台的滑动验证码。

在 Android端app上,自定义View,仿一个斗鱼web端滑动验证码。 博文:http://blog.csdn.net/zxt0601/article/details/53315975

Usage 用法:

Step 1. Add the JitPack repository to your build file 在项目根build.gradle文件中增加JitPack仓库依赖。

    allprojects {
		repositories {
			...
			maven { url "https://jitpack.io" }
		}
	}

Step 2. Add the dependency

    dependencies {
	        compile 'com.github.mcxtzhang:SwipeCaptcha:V1.0.0'
	}

Step 3.

    

    

那么本控件包含不仅包含以下功能:

  • 随机区域**起点(左上角x,y)**生成一个验证码阴影。
  • 验证码拼图 凹凸图形会随机变换。
  • 验证码区域宽高可自定义。
  • 抠图验证码区域,绘制一个用于联动滑动的验证码滑块。
  • 验证失败,会闪烁几下然后回到原点。
  • 验证成功,会有白光扫过的动画。

分解一下验证码核心实现思路:

  • 控件继承自ImageView。理由: 1 如果放在项目中用,验证码图片希望可以是接口返回。ImageView以及其子类支持花式加载图片。 2 继承自ImageView,绘制图片本身不用我们干预,也不用我们操心scaleType,节省很多工作。
  • 在onSizeChanged()方法中生成 和 控件宽高相关的属性值: 1 初始化时随机生成验证码区域起点 2 生成验证码区域Path 3 生成滑块Bitmap
  • onDraw()时,依次绘制: 1 验证码阴影 2 滑块

to do list,待完善

  • abstract dragbar(seekbar) interface

  • SwipeCaptcha inside to hold the interface to do something

  • 抽象拖动条接口

  • SwipeCaptcha内部要持有这个接口 做一些事情

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言