Commit 92165f37 by 霍志良

feat:修改自定义验证码UIwidget

parent 2b292d02
...@@ -76,7 +76,10 @@ class SquarePinField : PinField{ ...@@ -76,7 +76,10 @@ class SquarePinField : PinField{
}else{ }else{
drawRect(canvas,paddedX1,paddedY1,paddedX2,paddedY2, fieldPaint) drawRect(canvas,paddedX1,paddedY1,paddedX2,paddedY2, fieldPaint)
} }
/*
* 绘制文字的位置
*
* */
if(character!=null) { if(character!=null) {
canvas?.drawText(character.toString(),textX,textY, textPaint) canvas?.drawText(character.toString(),textX,textY, textPaint)
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView <ImageView
android:id="@+id/img_reg_back" android:id="@+id/img_reg_back"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -12,8 +13,8 @@ ...@@ -12,8 +13,8 @@
android:layout_marginTop="@dimen/platform_dp_20" android:layout_marginTop="@dimen/platform_dp_20"
android:src="@drawable/user_ic_back_black" android:src="@drawable/user_ic_back_black"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
/>
<TextView <TextView
android:id="@+id/tv_login_title" android:id="@+id/tv_login_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -24,47 +25,57 @@ ...@@ -24,47 +25,57 @@
android:textSize="22sp" android:textSize="22sp"
app:layout_constraintLeft_toRightOf="@id/img_reg_back" app:layout_constraintLeft_toRightOf="@id/img_reg_back"
app:layout_constraintTop_toBottomOf="@id/img_reg_back" /> app:layout_constraintTop_toBottomOf="@id/img_reg_back" />
<TextView
android:layout_width="wrap_content" <TextView
android:layout_height="wrap_content" android:id="@+id/tv_phone"
android:text="已发送至+86 137 7759 3333" android:layout_width="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tv_login_title" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_5" android:layout_marginTop="@dimen/platform_dp_5"
app:layout_constraintStart_toStartOf="@id/tv_login_title" android:text="已发送至+86 137 7759 3333"
android:id="@+id/tv_phone" app:layout_constraintStart_toStartOf="@id/tv_login_title"
> app:layout_constraintTop_toBottomOf="@id/tv_login_title" />
</TextView>
<TextView <TextView
android:id="@+id/tv_countdown_time" android:id="@+id/tv_countdown_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/platform_dp_40"
android:textColor="@color/pay_color_999999" android:textColor="@color/pay_color_999999"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="@id/tv_phone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_phone" app:layout_constraintTop_toTopOf="@id/tv_phone"
app:layout_constraintBottom_toBottomOf="@id/tv_phone"
android:layout_marginEnd="@dimen/platform_dp_40"
android:textSize="13sp"
tools:text="发送验证码" tools:text="发送验证码"
tools:visibility="visible" /> tools:visibility="visible" />
<com.yidianling.user.widget.PinField.SquarePinField <com.yidianling.user.widget.PinField.SquarePinField
android:id="@+id/verify_code" android:id="@+id/verify_code"
android:cursorVisible="true"
app:User_highlightType="currentField"
app:User_isCursorEnabled="true"
android:layout_width="0dp" android:layout_width="0dp"
android:textSize="20sp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tv_phone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginStart="@dimen/platform_dp_40" android:layout_marginStart="@dimen/platform_dp_40"
android:layout_marginEnd="@dimen/platform_dp_40"
android:layout_marginTop="67dp" android:layout_marginTop="67dp"
app:user_cornerRadius="8dp" android:layout_marginEnd="@dimen/platform_dp_40"
app:User_noOfFields="4" android:cursorVisible="true"
android:inputType="number"
android:focusable="true" android:focusable="true"
> android:inputType="number"
</com.yidianling.user.widget.PinField.SquarePinField> android:textSize="20sp"
app:User_highlightType="currentField"
app:User_isCursorEnabled="true"
app:User_noOfFields="4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_phone"
app:user_cornerRadius="8dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_15"
android:text="密码登录"
android:id="@+id/login_password"
app:layout_constraintStart_toStartOf="@id/verify_code"
app:layout_constraintTop_toBottomOf="@id/verify_code">
</TextView>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment