滑动拼图验证
依赖导入
implementation 'com.luozm.captcha:captcha:1.1.2'
页面布局
<com.luozm.captcha.Captcha
android:id="@+id/captCha"
android:layout_width="match_parent"
android:layout_height="270dp"
android:visibility="visible"
app:blockSize="50dp"
app:max_fail_count="5"
app:mode="mode_bar"
app:src="@drawable/xiaogou" />
页面实现
//拼图验证码
captCha.setCaptchaListener(new Captcha.CaptchaListener() {
@Override
public String onAccess(long time) {
Toast.makeText(Main2Activity.this, "验证成功", Toast.LENGTH_SHORT).show();
return "验证通过.";
}
@Override