Android仿微信六位数字输入框
Users of your library will need add the jitpack.io repository:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and:
dependencies {
compile 'com.github.zhouchupen:SixNumEditText:v1.0'
}
Note: do not add the jitpack.io repository under buildscript
If you add a sample app to the same repo then your app needs to depend on the library. To do this in your app/build.gradle add a dependency in the form:
dependencies {
compile project(':library')
}
where 'library' is the name of your library module.
You may need this to use the edittext. Put this into your xml file:
<com.scnu.zhou.widget.SixNumEditText
android:id="@+id/sixNumEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.scnu.zhou.widget.SixNumEditText>
If you want to input a number, take this:
sixNumEditText.input(number);
And if you want to backspace, take this:
sixNumEditText.backspace();
You also be able to know when is finished input:
sixNumEditText.setOnCompleteInputListener(new SixNumEditText.OnCompleteInputListener() {
@Override
public void onCompleteInput() {
// finished input
}
});
And it always be accompanied with a NumberKeyBoard.