fix: padding 自定适配
This commit is contained in:
@@ -82,6 +82,8 @@ public class VerificationCodeInput extends ViewGroup {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
TextWatcher textWatcher = new TextWatcher() {
|
TextWatcher textWatcher = new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
@@ -241,7 +243,7 @@ public class VerificationCodeInput extends ViewGroup {
|
|||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
int parentWidth = getLayoutParams().width;
|
int parentWidth = getMeasuredWidth();
|
||||||
if (parentWidth == LayoutParams.MATCH_PARENT) {
|
if (parentWidth == LayoutParams.MATCH_PARENT) {
|
||||||
parentWidth = getScreenWidth();
|
parentWidth = getScreenWidth();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
tools:context="com.dalimao.verificationcodeinput.MainActivity">
|
tools:context="com.dalimao.verificationcodeinput.MainActivity">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="600px"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -39,10 +39,10 @@
|
|||||||
android:padding="12dp"
|
android:padding="12dp"
|
||||||
/>
|
/>
|
||||||
<com.dalimao.corelibrary.VerificationCodeInput
|
<com.dalimao.corelibrary.VerificationCodeInput
|
||||||
android:layout_width="800px"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/colorAccent"
|
android:background="@color/colorAccent"
|
||||||
ver:box="4"
|
ver:box="3"
|
||||||
ver:box_bg_normal="@drawable/verification_edit_bg_normal"
|
ver:box_bg_normal="@drawable/verification_edit_bg_normal"
|
||||||
ver:box_bg_focus="@drawable/verification_edit_bg_focus"
|
ver:box_bg_focus="@drawable/verification_edit_bg_focus"
|
||||||
ver:child_h_padding="5dp"
|
ver:child_h_padding="5dp"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
<dimen name="activity_horizontal_margin">400dp</dimen>
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user