GithubHelp home page GithubHelp logo

codeedittext's Introduction

CodeEditText

preview

声明依赖项

在项目根目录的 build.gradle 中添加 JitPack 仓库

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

添加依赖

dependencies {
    implementation 'com.github.aitsuki:CodeEditText:1.0.1'
}

使用方式

<com.aitsuki.widget.CodeEditText android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:inputType="number" android:maxLength="4" />

使用方式和 EditText 相同,CodeEditText 只是改变了它的测量方式和绘制方式,暂不支持 Password 类型的 inputType。 除此之外,提供了几个自定义属性用来调整样式。

<declare-styleable name="CodeEditText">
    <!--  方块之间的间距  -->
    <attr name="boxSpacing" format="dimension" />

    <!--  方块内间距,仅控件宽度为 wrap_content 时有效  -->
    <attr name="boxPadding" format="dimension" />

    <!--  方块的圆角属性  -->
    <attr name="boxRadius" format="dimension" />

    <!--  方块的宽高比,仅控件高度为 wrap_content 时有效  -->
    <attr name="boxRatio" format="float" />

    <!--  方块描边粗细  -->
    <attr name="boxStroke" format="dimension" />

    <!--  方块颜色  -->
    <attr name="boxColor" format="color" />

    <!--  方块描边颜色  -->
    <attr name="boxStrokeColor" format="color" />

    <!--  方块描边颜色(有焦点时)  -->
    <attr name="boxStrokeFocusedColor" format="color" />
</declare-styleable>

License

MIT © Aitsuki

codeedittext's People

Contributors

aitsuki avatar

Watchers

 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.