ID Verification Android SDK提供自定义UI颜色、icon图标的接口,开发者可以通过编写自定义UI配置,以文件或JSON数据格式通过传入setCustomUIConfig接口实现UI的自定义效果。本文为您介绍UI自定义接口说明以及相关的代码示例。
部分自定义配置可能需要依赖SDK升级,建议您在使用之前将SDK升级至最新版本。如用户界面自定义设置与验证接口的扩展参数存在冲突,优先使用用户界面自定义设置。请确保 UI 自定义设置优先于任何验证接口参数,以提供一致且直观的用户体验。
接口说明
接口定义
Android SDK中提供了自定义UI颜色和icon图标的接口:setCustomUIConfig。您可以通过调用此方法并传入对应参数来实现自定义UI的效果。
/**
* 设置自定义UI颜色和icon图标
*
* @return 配置文件检测出的异常信息。
* @description 此接口用于设置自定义UI。
* @paramType paramType 参数类型{@link IDTFacade} ,可传范围
* {@link IDTFacade.EXT_PARAMS_CONFIG_JSON} | {@link IDTFacade.EXT_PARAMS_CONFIG_ASSETS_NAME})。
*
* @params {@link String} params 参数值,与paramType相对应的值。
*/
public String setCustomUIConfig(@IDTFacade int paramType, String param) {
// ...
}入参说明
名称 | 类型 | 说明 |
paramType | int | 配置自定义入参的类型,可选值:
|
param | String | 根据paramType取值传入相应数据。 |
返回值
String类型,当SDK对param内容解析遇到错误或出现异常信息时会通过提示信息的方式返回。当配置参数无效时,请重点关注返回值信息。
示例代码
//传入assets文件名
String fileName = "DTFCustomUIConfig.json";
int paramType = IDTFacade.EXT_PARAMS_CONFIG_ASSETS_NAME;
String customUIErrMsg = IdentityPlatform.getInstance().setCustomUIConfig(paramType, fileName);
//传入JSON字符串
String jsonConfig = "<JSON格式的自定义UI配置>";
int paramType = IDTFacade.EXT_PARAMS_CONFIG_JSON;
String customUIErrMsg = IdentityPlatform.getInstance().setCustomUIConfig(paramType, jsonConfig);自定义UI配置
自定义UI目前允许用户自定义认证页面的字体颜色和部分Icon。
完整配置示例
{
"faceConfig": {
"faceBGColor": "#A8D8B4",
"exitIconBase64": "exit_icon_base64",
"faceTitleColor": "#3E5E7E",
"faceTipColor": "#F0E68C",
"interruptedAlertTitleColor": "#FF6347",
"interruptedAlertMessageColor": "#4682B4",
"interruptedAlertConfirmColor": "#DDA0DD",
"permissionFailedAlertTitleColor": "#6A5ACD",
"permissionFailedAlertMessageColor": "#8A2BE2",
"permissionFailedAlertConfirmColor": "#5F9EA0",
"tooManyRetriesAlertTitleColor": "#DC143C",
"tooManyRetriesAlertMessageColor": "#00FFFF",
"tooManyRetriesAlertConfirmColor": "#B8860B",
"faceProgressStartColor": "#006400",
"faceProgressEndColor": "#BDB76B",
"exitAlertTitleColor": "#8B008B",
"exitAlertMessageColor": "#556B2F",
"exitAlertCancelColor": "#FF8C00",
"exitAlertConfirmationColor": "#9932CC",
"timeoutAlertTitleColor": "#E9967A",
"timeoutAlertMessageColor": "#8FBC8F",
"timeoutAlertConfirmationColor": "#483D8B",
"verifyLoadingColor": "#2F4F4F",
"verifyNetworkErrorAlertTitleColor": "#00CED1",
"verifyNetworkErrorAlertMessageColor": "#9400D3",
"verifyNetworkErrorAlertCancelColor": "#FF1493",
"verifyNetworkErrorAlertConfirmColor": "#00BFFF"
},
"ocrConfig": {
"exitIconBase64": "exit_icon_base64",
"ocrTitleColor": "#696969",
"ocrBorderColor": "#1E90FF",
"albumBase64": "album_base64",
"takePhotoBase64": "take_photo_base64",
"submitBase64": "submit_base64",
"ocrSubmitTitleColor": "#B22222",
"ocrLoadingColor": "#FFFAF0",
"failedAlertTitleColor": "#228B22",
"failedAlertMessageColor": "#FF00FF",
"failedAlertCancelColor": "#DCDCDC",
"failedAlertConfirmationColor": "#F8F8FF",
"ocrNetworkErrorAlertTitleColor": "#FFD700",
"ocrNetworkErrorAlertMessageColor": "#DAA520",
"ocrNetworkErrorAlertCancelColor": "#808080",
"ocrNetworkErrorAlertConfirmColor": "#008000",
"permissionFailedAlertTitleColor": "#ADFF2F",
"permissionFailedAlertMessageColor": "#F0FFF0",
"permissionFailedAlertConfirmColor": "#FF69B4",
"docErrorAlertTitleColor": "#CD5C5C",
"docErrorAlertMessageColor": "#4B0082",
"docErrorAlertCancelColor": "#FFFFF0",
"docErrorAlertConfirmColor": "#F0E68C",
"restrictionsAlertTitleColor": "#E6E6FA",
"restrictionsAlertMessageColor": "#FFF0F5",
"restrictionsAlertConfirmationColor": "#7CFC00",
"timeoutAlertTitleColor": "#FFFACD",
"timeoutAlertMessageColor": "#ADD8E6",
"timeoutAlertConfirmationColor": "#F08080",
"exitAlertTitleColor": "#E0FFFF",
"exitAlertCancelColor": "#FAFAD2",
"exitAlertConfirmationColor": "#D3D3D3",
"ocrMessageFailAlertTitleColor": "#90EE90",
"ocrMessageFailAlertCancelColor": "#FFB6C1",
"ocrMessageFailAlertConfirmColor": "#FFA07A",
"ocrResultExitIconBase64": "ocr_result_exit_icon_base64",
"ocrResultTitleColor": "#20B2AA",
"ocrResultTipBGColor": "#87CEFA",
"ocrResultTipColor": "#778899",
"ocrResultInfoTitleColor": "#B0C4DE",
"ocrResultInfoContentColor": "#FFFFE0",
"ocrResultConfirmBtnEnabledBGColor": "#00FF00",
"ocrResultConfirmBtnEnabledTitleColor": "#32CD32",
"ocrResultTipTitleColor": "#FAF0E6",
"ocrResultTipIconBase64": "ocr_result_tip_icon_base64",
"ocrResultErrorTipBGColor": "#FF00FF",
"ocrResultInfoBorderColor": "#800000",
"ocrResultConfirmBtnDisabledBGColor": "#66CDAA",
"ocrResultConfirmBtnDisabledTitleColor": "#0000CD",
"ocrResultExitAlertTitleColor": "#BA55D3",
"ocrResultExitAlertCancelColor": "#9370DB",
"ocrResultExitAlertConfirmationColor": "#3CB371",
"ocrResultInfoEmptyAlertTitleColor": "#7B68EE",
"ocrResultInfoEmptyAlertConfirmColor": "#00FA9A",
"ocrResultNetworkErrorAlertTitleColor": "#48D1CC",
"ocrResultNetworkErrorAlertMessageColor": "#C71585",
"ocrResultNetworkErrorAlertConfirmColor": "#191970",
"ocrResultNetworkErrorAlertCancelColor": "#F5FFFA",
"ocrResultInfoErrorAlertMessageColor": "#FFE4E1",
"ocrResultInfoErrorAlertConfirmColor": "#FFE4B5",
"unFloodLightBase64": "un_flood_light_base64",
"floodLightBase64": "flood_light_base64",
"autoScanBase64": "auto_scan_base64",
"takeShootBase64": "take_shoot_base64",
"ocrTakePhotoLabelColor": "#FFDEAD",
"ocrAlbumLabelColor": "#000080",
"ocrGuideExitIconBase64": "ocr_guide_exit_icon_base64",
"ocrGuideTitleColor": "#FDF5E6",
"ocrGuideContentColor": "#808000",
"ocrGuideStartBtnBGColor": "#6B8E23",
"ocrGuideStartBtnTextColor": "#FFA500",
"ocrGuideIndicatorSelectedColor": "#FF4500",
"ocrGuideIndicatorUnSelectedColor": "#DA70D6",
"nfcInputExitIconBase64": "nfc_input_exit_icon_base64",
"nfcInputTitleColor": "#EEE8AA",
"nfcInputPassportLabelColor": "#98FB98",
"nfcInputBirthdayLabelColor": "#AFEEEE",
"nfcInputValidityLabelColor": "#DB7093",
"nfcInputPassportEditColor": "#FFEFD5",
"nfcInputBirthdayEditColor": "#FFDAB9",
"nfcInputValidityEditColor": "#CD853F",
"nfcInputPassportEditHintColor": "#FFC0CB",
"nfcInputBirthdayEditHintColor": "#DDA0DD",
"nfcInputValidityEditHintColor": "#B0E0E6",
"nfcInputNextBtnBGSelectColor": "#800080",
"nfcInputNextBtnTextSelectColor": "#663399",
"nfcInputNextBtnBGUnSelectColor": "#FF0000",
"nfcInputNextBtnTextUnSelectColor": "#BC8F8F",
"nfcInputBackAlertTitleColor": "#4169E1",
"nfcInputBackAlertCancelColor": "#8B4513",
"nfcInputBackAlertConfirmColor": "#FA8072",
"nfcInputCheckAlertTitleColor": "#F4A460",
"nfcInputCheckAlertMessageColor": "#2E8B57",
"nfcInputCheckAlertConfirmColor": "#A0522D",
"nfcExitIconBase64": "nfc_exit_icon_base64",
"nfcTitleColor": "#C0C0C0",
"nfcContentColor": "#87CEEB",
"nfcConfirmBtnBGColor": "#6A5ACD",
"nfcConfirmBtnTextColor": "#708090",
"nfcReadBackAlertTitleColor": "#00FF7F",
"nfcReadBackAlertConfirmColor": "#4682B4",
"nfcReadBackAlertCancelColor": "#D2B48C",
"nfcSettingAlertTitleColor": "#D2691E",
"nfcSettingAlertMessageColor": "#9ACD32",
"nfcSettingAlertConfirmColor": "#FF7F50",
"nfcSettingAlertCancelColor": "#6495ED",
"nfcReadStatusExitBase64": "nfc_read_status_exit_base64",
"nfcReadStatusTextColor": "#DC143C"
}
}字段配置效果
faceModule
faceBGColor
| exitIconBase64
| faceTitleColor
|
faceTipColor
| interruptedAlertTitleColor
| interruptedAlertMessageColor
|
interruptedAlertConfirmColor
| permissionFailedAlertTitleColor
| permissionFailedAlertMessageColor
|
permissionFailedAlertConfirmColor
| tooManyRetriesAlertTitleColor
| tooManyRetriesAlertMessageColor
|
tooManyRetriesAlertConfirmColor
| faceProgressStartColor
| faceProgressEndColor
|
exitAlertTitleColor
| exitAlertMessageColor
| exitAlertCancelColor
|
exitAlertConfirmationColor
| timeoutAlertTitleColor
| timeoutAlertMessageColor
|
timeoutAlertConfirmationColor
| verifyLoadingColor
| verifyNetworkErrorAlertTitleColor
|
verifyNetworkErrorAlertMessageColor
| verifyNetworkErrorAlertCancelColor
| verifyNetworkErrorAlertConfirmColor
|
ocrModule
exitIconBase64
| ocrTitleColor
| ocrBorderColor
|
albumBase64 | takePhotoBase64
| submitBase64
|
ocrSubmitTitleColor
| ocrLoadingColor
| failedAlertTitleColor
|
failedAlertMessageColor
| failedAlertCancelColor
| failedAlertConfirmationColor
|
ocrNetworkErrorAlertTitleColor
| ocrNetworkErrorAlertMessageColor
| ocrNetworkErrorAlertCancelColor
|
ocrNetworkErrorAlertConfirmColor
| permissionFailedAlertTitleColor
| permissionFailedAlertMessageColor
|
permissionFailedAlertConfirmColor
| docErrorAlertTitleColor
| docErrorAlertMessageColor
|
docErrorAlertCancelColor
| docErrorAlertConfirmColor
| restrictionsAlertTitleColor
|
restrictionsAlertMessageColor
| restrictionsAlertConfirmationColor
| timeoutAlertTitleColor
|
timeoutAlertMessageColor
| timeoutAlertConfirmationColor
| exitAlertTitleColor
|
exitAlertCancelColor
| exitAlertConfirmationColor
| ocrMessageFailAlertTitleColor
|
ocrMessageFailAlertCancelColor
| ocrMessageFailAlertConfirmColor
| ocrResultExitIconBase64
|
ocrResultTitleColor
| ocrResultTipBGColor
| ocrResultTipColor
|
ocrResultInfoTitleColor
| ocrResultInfoContentColor
| ocrResultConfirmBtnEnabledBGColor
|
ocrResultConfirmBtnEnabledTitleColo
| ocrResultTipTitleColor
| ocrResultTipIconBase64
|
ocrResultErrorTipBGColor
| ocrResultInfoborderColor
| ocrResultConfirmBtnDisabledBGColor
|
ocrResultConfirmBtnDisabledTitleColor
| ocrResultExitAlertTitleColor
| ocrResultExitAlertCancelColor
|
ocrResultExitAlertConfirmationColor
| ocrResultInfoEmptyAlertTitleColor
| ocrResultInfoEmptyAlertConfirmColor
|
ocrResultNetworkErrorAlertTitleColor
| ocrResultNetworkErrorAlertMessageColor
| ocrResultNetworkErrorAlertConfirmColor
|
ocrResultNetworkErrorAlertCancleColor
| ocrResultInfoErrorAlertMessageColor
| ocrResultInfoErrorAlertConfirmColor
|
unFloodLightBase64
| floodLightBase64
| autoScanBase64
|
takeShootBase64
| ocrTakePhotoLabelColor
| ocrAlbumLabelColor
|
ocrGuideExitIconBase64
| ocrGuideTitleColor
| ocrGuideContentColor |
ocrGuideStartBtnBGColor
| ocrGuideStartBtnTextColor
| ocrGuideIndicatorSelectedColor
|
ocrGuideIndicatorUnSelectedColor
| nfcInputExitIconBase64
| nfcInputTitleColor
|
nfcInputPassportLabelColor
| nfcInputBirthdayLabelColor
| nfcInputValidityLabelColor
|
nfcInputPassportEditColor
| nfcInputBirthdayEditColor
| nfcInputValidityEditColor
|
nfcInputPassportEditHintColor
| nfcInputBirthdayEditHintColor
| nfcInputValidityEditHintColor
|
nfcInputNextBtnBGSelectColor
| nfcInputNextBtnTextSelectColor
| nfcInputNextBtnBGUnSelectColor
|
nfcInputNextBtnTextUnSelectColor
| nfcInputBackAlertTitleColor
| nfcInputBackAlertCancelColor
|
nfcInputBackAlertConfirmColor
| nfcInputCheckAlertTitleColor
| nfcInputCheckAlertMessageColor
|
nfcInputCheckAlertConfirmColor
| nfcExitIconBase64
| nfcTitleColor
|
nfcContentColor
| nfcConfirmBtnBGColor
| nfcConfirmBtnTextColor
|
nfcReadBackAlertTitleColor
| nfcReadBackAlertConfirmColor
| nfcReadBackAlertCancelColor
|
nfcSettingAlertTitleColor
| nfcSettingAlertMessageColor
| nfcSettingAlertConfirmColor
|
nfcSettingAlertCancelColor
| nfcReadStatusExitBase64
| nfcReadStatusTextColor
|





































































































































