Android中实现发送验证码功能,以及重新发送

Android中实现发送验证码功能,以及重新发送

  1. 引入splitedittext框架;
    //类似滴滴出行验证码输入框控件
    //https://github.com/jenly1314/SplitEditText
    implementation 'com.github.jenly1314:splitedittext:1.1.0'
  1. 页面中创建控件
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".component.input.activity.InputCodeActivity">

    <include layout="@layout/toolbar"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="@dimen/d30"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/verification_code"
            android:textColor="?attr/colorOnSurface"
            android:textSize="@dimen/text_large2"
            android:textStyle="bold"/>

        <TextView
            android:id="@+id/code_send_target"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/d10"
            android:text="@string/verification_code_sent_to"
            android:textColor="?attr/colorOnSurface"
            android:textSize="@dimen/s14"/>

<!--        验证码输入框-->
        <com.king.view.splitedittext.SplitEditText
            android:id="@+id/code"
            android:layout_width="match_parent"
            android:layout_height="@dimen/d50"
            android:layout_marginTop="<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值