使用方便的验证码输入框
implementation 'com.hxb:verification:1.0.1'
<com.hxb.verification.VerificationInputView
android:id="@+id/verification_input_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:child_bg_focus="@drawable/layer_bottom_orange"
app:child_bg_normal="@drawable/layer_bottom_gray"
/>
mVerificationInputView.setListener(new VerificationInputView.Listener() {
@Override
public void onChange(String[] strings) {
//文字改变就会回调
Log.d(mTag,"onChange: "+ Arrays.toString(strings));
}
@Override
public void onComplete(String string) {
//仅在完成后回调
Log.d(mTag,"onComplete: "+string);
}
});
属性 | 解释 |
---|---|
child_count | 输入框的数量 |
child_left_margin | 输入框的左边距(默认为4dp,第一个为0,不可改变) |
child_right_margin | 输入框的右边距(默认为4dp,最后一个为0,不可改变) |
child_width | 输入框的宽度(默认为48dp) |
child_height | 输入框的右边距(默认为48dp) |
child_bg_focus | 输入框获取焦点时的背景或者有文字的背景 |
child_bg_normal | 输入框没有文字时候的背景 |
Copyright 2019 hxb
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.