GithubHelp home page GithubHelp logo

verifycodeinputview's Introduction

VerifyCodeInputView

自定义验证码输入框,支持自定义验证码输入框的宽高、间距、数量、输入框边框的宽度、颜色,支持输入框宽度自适应。
目前支持三种输入框类型:线形输入框、矩形输入框、圆形输入框。具体效果如下:

使用效果

  • 线形输入框

线形输入框

  • 矩形输入框

矩形输入框

  • 圆形输入框

圆形输入框

引用方式

  • 添加JitPack仓库
    在项目根目录的build.gradle中配置JitPack仓库:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • 添加项目依赖
    在需要调用的module的build.gradle中添加依赖:
implementation ("com.github.CharlieJiang:VerifyCodeInputView:v1.1.2")
  • 在xml布局中引用
    <com.cocoas.view.VerifyCodeInputView
        android:id="@+id/main_verifyCodeInputView_customMulti"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="number"
        app:autoFit="true"
        app:boxCount="4"
        app:boxSpacing="10dp"
        app:boxHeight="60dp"
        app:boxWidth="60dp"
        app:boxBorderHeight="3dp"
        app:boxBorderColorNormal="@android:color/black"
        app:boxBorderColorFocused="@android:color/holo_red_dark"
        app:boxType="circle"
        ></com.cocoas.view.VerifyCodeInputView>

属性说明

  1. boxWidth、boxHeight

单个验证码输入框的宽高(暂时只支持宽高相等的设置,当宽高值不同时,取两者中较小值)

  1. boxSpacing

单个验证码输入框间的间距(暂时只支持宽高相等的设置,当宽高值不同时,取两者中较小值)

  1. boxCount

验证码位数

  1. boxBorderHeight

单个验证码输入框的边框高度

  1. boxBorderColorNormal

单个验证码输入框边框的默认颜色

  1. boxBorderColorFocused

单个验证码输入框边框的高亮颜色

  1. autoFit

设置单个验证码输入框的宽高是否根据父布局宽度自适应。
注意:此属性需要与android:layout_width="match_parent"属性一起使用,否则可能无效。

  1. boxType

设置输入框类型,类型值及说明如下:

boxType值 说明
line 线形输入框(输入框底部显示一条横线)(默认值)
rect 矩形输入框(目前只支持正方形)
circle 圆形输入框

verifycodeinputview's People

Contributors

charliejiang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.