代码拉取完成,页面将自动刷新
1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
2.在entry模块的build.gradle文件中,
dependencies {
implementation('com.gitee.chinasoft_ohos:BankCardFormat:1.0.0')
......
}
组件主要由TextField控件和检索 TextWatcher组成。
原开源项目重写TextField,现在openharmony项目重写DependentLayout包含TextField的组合控件。
XML中添加自定义控件:
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:orientation="vertical">
<com.example.library.BandCardEditText
ohos:id="$+id:et"
ohos:height="match_content"
ohos:width="match_parent"
ohos:background_element="#f2f2f2"
ohos:left_margin="15vp"
ohos:top_margin="15vp"
ohos:right_margin="15vp"
ohos:padding="10vp"
ohos:text="1020332121012012142"
ohos:text_alignment="vertical_center"
ohos:text_size="18fp"
ohos:text_input_type="pattern_number"/>
<Text
ohos:id="$+id:text"
ohos:height="match_content"
ohos:width="match_content"
ohos:background_element="$graphic:background_ability_main"
ohos:left_margin="15vp"
ohos:right_margin="15vp"
ohos:text="所属银行:"
ohos:multiple_lines="true"
ohos:text_color="#666666"
ohos:text_size="14fp"/>
</DirectionalLayout>
输入控件加入自动检索和格式化功能,并且在输入信息后自动格式化和检索所属信息进行显示:
BandCardEditText editText = (BandCardEditText) findComponentById(ResourceTable.Id_et);
editText.setBankCardListener(new BankCardListener() {
@Override
public void success(String name) {
tv.setText("所属银行:" + name);
}
@Override
public void failure() {
tv.setText("所属银行:");
}
});
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。