fix: 支持大小定义

This commit is contained in:
guangli.lgl
2017-05-23 17:53:52 +08:00
parent d19fc264c9
commit 548abeb85c
4 changed files with 25 additions and 1 deletions

View File

@@ -59,6 +59,8 @@ public class VerificationCodeInput extends ViewGroup {
boxBgFocus = a.getDrawable(R.styleable.vericationCodeInput_box_bg_focus);
boxBgNormal = a.getDrawable(R.styleable.vericationCodeInput_box_bg_normal);
inputType = a.getString(R.styleable.vericationCodeInput_inputType);
boxWidth = (int) a.getDimension(R.styleable.vericationCodeInput_child_width, boxWidth);
boxHeight = (int) a.getDimension(R.styleable.vericationCodeInput_child_height, boxHeight);
initViews();
}

View File

@@ -5,6 +5,8 @@
<attr name="box" format="integer" />
<attr name="child_h_padding" format="dimension"/>
<attr name="child_v_padding" format="dimension"/>
<attr name="child_width" format="dimension"/>
<attr name="child_height" format="dimension"/>
<attr name="padding" format="dimension"/>
<attr name="box_bg_focus" format="reference"/>
<attr name="box_bg_normal" format="reference"/>

View File

@@ -26,6 +26,6 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
//compile 'com.github.liuguangli:VerificationCodeInput:1.0'
//compile 'com.github.liuguangli:VerificationCodeInput:1.3'
compile project(':corelibrary');
}

View File

@@ -73,4 +73,24 @@
android:layout_centerInParent="true"
android:layout_marginBottom="16dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="定义大小:"
android:padding="12dp"
/>
<com.dalimao.corelibrary.VerificationCodeInput
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ver:box="5"
ver:box_bg_normal="@drawable/verification_edit_bg_normal"
ver:box_bg_focus="@drawable/verification_edit_bg_focus"
ver:child_h_padding="5dp"
ver:child_width="60dp"
ver:child_height="40dp"
ver:inputType="password"
android:layout_centerInParent="true"
android:layout_marginBottom="16dp"
/>
</LinearLayout>