Skip to content

Commit

Permalink
为VerifyCodeEditText增加更丰富的使用案例
Browse files Browse the repository at this point in the history
  • Loading branch information
xuexiangjys committed Nov 21, 2019
1 parent a122c75 commit 7a5f96d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class VerifyCodeEditTextFragment extends BaseFragment implements VerifyCo
VerifyCodeEditText vcet2;
@BindView(R.id.vcet_3)
VerifyCodeEditText vcet3;
@BindView(R.id.vcet_4)
VerifyCodeEditText vcet4;

@Override
protected int getLayoutId() {
Expand All @@ -38,6 +40,7 @@ protected void initListeners() {
vcet1.setOnInputListener(this);
vcet2.setOnInputListener(this);
vcet3.setOnInputListener(this);
vcet4.setOnInputListener(this);
}

@Override
Expand All @@ -60,5 +63,6 @@ public void onViewClicked() {
vcet1.clearInputValue();
vcet2.clearInputValue();
vcet3.clearInputValue();
vcet4.clearInputValue();
}
}
28 changes: 28 additions & 0 deletions app/src/main/res/drawable/custom_vcet_shape_bg_focus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
~
~ 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.
~
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="bottom">
<shape android:shape="rectangle">
<solid android:color="#A6D8EB" />
<!-- 大小 -->
<size
android:width="45dp"
android:height="2dp" /><!-- 宽度和高度 -->

</shape>
</item>
</layer-list>
27 changes: 27 additions & 0 deletions app/src/main/res/drawable/custom_vcet_shape_bg_normal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
~
~ 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.
~
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="bottom">
<shape android:shape="rectangle">
<solid android:color="#C7C7CD" />
<!-- 大小 -->
<size
android:width="45dp"
android:height="2dp" /><!-- 宽度和高度 -->
</shape>
</item>
</layer-list>
15 changes: 14 additions & 1 deletion app/src/main/res/layout/fragment_verify_code_edittext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,23 @@
android:layout_height="wrap_content"
app:vcet_is_pwd="true" />

<com.xuexiang.xui.widget.edittext.verify.VerifyCodeEditText
android:id="@+id/vcet_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:vcet_bg_focus="@drawable/custom_vcet_shape_bg_focus"
app:vcet_bg_normal="@drawable/custom_vcet_shape_bg_normal"
app:vcet_is_pwd="false"
app:vcet_number="4"
app:vcet_text_color="@color/xui_config_color_primary_text"
app:vcet_text_size="16sp"
app:vcet_width="45dp" />

<com.xuexiang.xui.widget.alpha.XUIAlphaButton
android:id="@+id/btn_clear"
style="@style/Button.Primary.wrap"
android:layout_gravity="center_horizontal"
android:text="清空"/>
android:layout_marginTop="?attr/xui_config_content_spacing_vertical"
android:text="清空" />

</LinearLayout>

0 comments on commit 7a5f96d

Please sign in to comment.