└── src└── main├── AndroidManifest.xml├── assets├── java└── res├── values-zh-rCN│ └── custom_strings.xml└── values-zh-rHK└── custom_strings.xml
└── src└── main├── AndroidManifest.xml├── assets├── java└── res├── values-th-rTH│ └── custom_strings.xml <<<<<<<<<<< Taking Thai as an example, values-th-rTH├── values-zh-rCN│ └── custom_strings.xml└── values-zh-rHK└── custom_strings.xml
EkycHyConfig ekycHyConfig = new EkycHyConfig();ekycHyConfig.setLanguageStyle(LanguageStyle.CUSTOMIZE_LANGUAGE);ekycHyConfig.setLanguageCode("th-TH");
Language code | Corresponding countries or regions of use |
af-ZA | Dutch - South Africa |
sq-AL | Albanian - Albania |
ar-DZ | Arabic - Algeria |
ar-BH | Arabic - Bahrain |
ar-EG | Arabic - Egypt |
ar-IQ | Arabic - Iraq |
ar-JO | Arabic - Jordan |
ar-KW | Arabic - Kuwait |
ar-LB | Arabic - Lebanon |
ar-LY | Arabic - Libya |
ar-MA | Arabic - Morocco |
ar-OM | Arabic - Oman |
ar-QA | Arabic - Qatar |
eu-ES | Basque - Basque |
be-BY | Belarusian - Belarus |
bg-BG | Bulgarian - Bulgaria |
ca-ES | Catalan - Catalan |
zh-HK | Chinese - Hong Kong (China) |
zh-MO | Chinese - Macao (China) |
zh-CN | Chinese - China |
zh-SG | Chinese - Singapore |
zh-TW | Chinese - Taiwan (China) |
zh-CHS | Chinese (Simplified) |
zh-CHT | Chinese (Traditional) |
hr-HR | Croatian - Croatia |
cs-CZ | Czech - Czech Republic |
da-DK | Danish - Denmark |
div-MV | Dhivehi - Maldives |
nl-BE | Dutch - Belgium |
nl-NL | Dutch - Netherlands |
en-AU | English - Australia |
en-CA | English - Canada |
en-ZA | English - South Africa |
en-PH | English - Philippines |
en-NZ | English - New Zealand |
en-GB | English - United Kingdom |
en-US | English - United States |
fa-IR | Persian - Iran |
fi-FI | Finnish - Finland |
fr-FR | French - France |
fr-BE | French - Belgium |
fr-MC | French - Monaco |
fr-CH | French - Switzerland |
gl-ES | Galician - Spain |
ka-GE | Georgian - Georgia |
de-DE | German - Germany |
de-LU | German - Luxembourg |
de-CH | German - Switzerland |
el-GR | Greek - Greece |
gu-IN | Gujarati - India |
he-IL | Hebrew - Israel |
hi-IN | Hindi - India |
hu-HU | Hungarian - Hungary |
is-IS | Icelandic - Iceland |
it-IT | Italian - Italy |
ja-JP | Japanese - Japan |
kk-KZ | Kazakh - Kazakhstan |
kn-IN | Kannada - India |
ko-KR | Korean - South Korea |
lv-LV | Latvian - Latvia |
lt-LT | Lithuanian - Lithuania |
ms-BN | Malay - Brunei |
ms-MY | Malay - Malaysia |
mr-IN | Marathi - India |
mn-MN | Mongolian - Mongolia |
nn-NO | Norwegian (Nynorsk) - Norway |
pl-PL | Polish - Poland |
pt-BR | Portuguese - Brazil |
pt-PT | Portuguese - Portugal |
ro-RO | Romanian - Romania |
sa-IN | Sanskrit - India |
ru-RU | Russian - Russia |
sk-SK | Slovak - Slovakia |
es-AR | Spanish - Argentina |
es-ES | Spanish - Spain |
sv-SE | Swedish - Sweden |
th-TH | Thai - Thailand |
tr-TR | Turkish - Türkiye |
uk-UA | Ukrainian - Ukraine |
ur-PK | Urdu - Pakistan |
vi-VN | Vietnamese - Vietnam |
OcrUiConfig and FaceAuthUiConfig in EkycHyConfig, you can achieve complete UI customization.resources/custom_layout/ directory:ocr_detect_fragment.xml: Default layout for the OCR recognition page.huiyan_fragment_authing.xml: Default layout for the selfie verification page.ocr_detect_fragment.xml is the layout template for the OCR document recognition page, with the root layout as RelativeLayout.android:id cannot be modified, but their position, size, color, and other attributes can be adjusted:View ID | Type | Description |
camera_surface_view | TextureView | Camera preview |
ocr_mask_view | CameraMaskView | Document recognition frame and mask support style adjustments via custom attributes. For details, see below CameraMaskView custom attributes. |
ocr_tips_tv | OcrDetectTipsView | Recognition prompt text, with real-time updates by the SDK |
album_image_button | ImageButton | Album selection button |
take_picture_button | ImageButton | Capture button |
light_image_button | ImageButton | Flash toggle button |
txy_detect_back | ImageView | Default back button (hidden by default, visibility controlled by the SDK) |
onMainViewCreate callback in setOcrEventCallBack().ocr_mask_view supports the following XML custom attributes (using the app: namespace):Required | Type | Description |
txy_mask_color | color | Mask background color |
txy_mask_margin | dimension | Mask margin, only effective when txy_position_flag="margin" |
txy_position_flag | enum | Positioning mode for the recognition frame: center (centered) / margin (positioned by margin) |
Required | Type | Description |
txy_tip_text | string | Prompt text content |
txy_tip_color | color | Default state text color |
txy_tip_light_color | color | Text color in highlighted state (when recognition succeeds) |
txy_tip_error_color | color | Error state text color |
txy_tip_size | dimension | Text size |
txy_tip_margin | dimension | Spacing between text and recognition frame |
txy_tip_show | boolean | Whether to display the prompt text |
txy_tip_textStyle | flag | Font style: normal / bold / italic / bold_italic |
Required | Type | Description |
txy_bottom_tips_txt | string | Bottom prompt text content |
txy_bottom_tip_size | dimension | Bottom text size |
txy_bottom_tip_color | color | Bottom text color |
txy_bottom_tip_margin_top | dimension | Spacing between the bottom text and the bottom edge of the recognition frame |
txy_bottom_tip_show | boolean | Whether to display the bottom prompt text |
txy_bottom_tips_textStyle | flag | Font style: normal / bold / italic / bold_italic |
Required | Type | Description |
txy_line_color | color | Corner line default color |
txy_line_light_color | color | Highlight color when recognition succeeds |
txy_line_error_color | color | Error state color |
txy_line_width | dimension | Corner line width |
txy_line_length | dimension | Corner line length |
txy_line_padding | dimension | Spacing between the corner lines and the inner edge of the recognition frame |
txy_line_margin | dimension | Spacing between the corner lines and the screen edge |
Required | Type | Description |
txy_front_head_icon | reference | Guidance icon for the portrait area on the front of the document |
txy_front_head_scale_size | float | Portrait icon scaling ratio |
txy_front_head_margin_top | dimension | Spacing between the portrait icon and the top edge of the recognition frame |
txy_front_head_margin_right | dimension | Spacing between the portrait icon and the right edge of the recognition frame |
txy_back_emblem_icon | reference | Guidance icon for the national emblem area on the back of the document |
txy_back_emblem_scale_size | float | National emblem icon scaling ratio |
txy_back_emblem_margin_top | dimension | Spacing between the national emblem icon and the top edge of the recognition frame |
txy_back_emblem_margin_left | dimension | Spacing between the national emblem icon and the left edge of the recognition frame |
Required | Type | Description |
txy_maskView_view_type | flag | Document type styles: normal / id_front / id_back / hk_03 / hk_18 / hk_macao_pass |
txy_mask_view_use_type | flag | Layout direction: portrait (vertical screen) / landscape (horizontal screen) |
txy_rect_height_weight_hor | integer | Height ratio of the recognition frame in landscape mode |
Required | Type | Description |
txy_is_show_scanline | boolean | Whether to display the scanning animated line |
txy_scanline_animator_time | integer | Scanning line animation duration (ms) |
txy_scanline_start_color | color | Scanning line starting gradient color |
txy_scanline_mid_color | color | Scanning line middle gradient color |
txy_scanline_end_color | color | Scanning line ending gradient color |
txy_scanline_start_color_size_range | integer | Starting color gradient range |
txy_scanline_start_to_mid_color_size_range | integer | Starting to middle color transition range |
OcrUiConfigoverlapping configuration items.OcrUiConfig. When both are set simultaneously, the code configuration takes precedence and overrides the XML attributes:XML attributes | OcrUiConfig method | Description |
txy_line_color | setCardFrameDefaultColor() | Corner line default color |
txy_line_light_color | setCardFrameColor() | Highlight color for successful recognition |
txy_line_error_color | setWarnErrorTextColor() | Error state color |
txy_tip_color | setDefaultTipTextColor() | Hint text default color |
txy_tip_light_color | setSuccessRemindTextColor() | Prompt text highlight color |
txy_tip_error_color | setWarnErrorTextColor() | Prompt text error color |
txy_bottom_tips_txt | setBottomTipsContext() | Bottom prompt text content |
OcrUiConfig configuration to prevent inconsistencies caused by setting both sides simultaneously.huiyan_fragment_authing.xml is the layout template for the liveness verification page, with HuiYanReflectLayout (inherits from ConstraintLayout) as the root layout. The SDK overlays camera capture and animation logic on this layout.android:id cannot be modified, but their position, size, color, and other attributes can be adjusted (it is not recommended to adjust txy_camera_gather_view, txy_auth_common_background_views, and txy_auth_loading_front_animator_view):View ID | Type | Description |
txy_auth_layout_bg | HuiYanReflectLayout | Root layout |
txy_cancel_txt_btn | TextView | Cancel/Back button, the SDK binds a click event to exit the liveness verification process. |
txy_count_down_txt_view | TextView | Countdown text, the SDK controls its visibility and content. |
txy_auth_feed_back_txt | TextView | Liveness verification main prompt text, with real-time updates by the SDK. |
txy_camera_gather_view | CameraDateGatherView | Camera preview |
txy_auth_common_background_views | CommonAuthBackView | Face circle background animation |
txy_camera_prepare_img | ImageView | Preparation phase avatar guide image |
txy_auth_loading_front_animator_view | LoadingFrontAnimatorView | Loading foreground animation |
txy_auth_feed_back_extra_tip_txt | TextView | Secondary prompt text (additional warning message) |
txy_hud_view | HudView | Glare detection secondary prompt view |
onMainViewCreate callback in setAuthEventCallBack().OcrUiConfig.setPortraitLayoutResId() by passing in the Resource ID of the custom layout:EkycHyConfig ekycHyConfig = new EkycHyConfig();OcrUiConfig ocrUiConfig = new OcrUiConfig();ocrUiConfig.setPortraitLayoutResId(R.layout.custom_ocr_layout);ekycHyConfig.setOcrUiConfig(ocrUiConfig);
android:id of these Views. It is recommended to modify using ocr_detect_fragment.xml as a template.FaceAuthUiConfig.setAuthLayoutResId() by passing in the Resource ID of the custom layout:EkycHyConfig ekycHyConfig = new EkycHyConfig();FaceAuthUiConfig faceAuthUiConfig = new FaceAuthUiConfig();faceAuthUiConfig.setAuthLayoutResId(R.layout.custom_face_auth_layout);ekycHyConfig.setFaceAuthUiConfig(faceAuthUiConfig);
android:id of all Views must match those required by the selfie verification SDK, as these Views participate in interface event binding. It is recommended to modify using huiyan_fragment_authing.xml as a template.setAuthEventCallBack() method. When the main interface for liveness face detection is created, the HuiYanAuthEventCallBack.onMainViewCreate(View) method is called back. At this point, you can obtain controls from the custom layout and register event listeners:EkycHySdk.setAuthEventCallBack(new HuiYanAuthEventCallBack() {@Overridepublic void onMainViewCreate(View authView) {if (authView == null) {return;}// Obtain controls in the custom layoutButton customButton = authView.findViewById(R.id.custom_button_id);if (customButton != null) {customButton.setOnClickListener(v -> {// Handle custom button click eventsLog.d(TAG, "Custom button clicked");});}}@Overridepublic void onMainViewDestroy() {// Cleanup upon page destructionLog.d(TAG, "Auth view destroyed");}});
setOcrEventCallBack() method:EkycHySdk.setOcrEventCallBack(new OcrEventListener() {@Overridepublic void onMainViewCreate(View ocrView) {if (ocrView == null) {return;}// Obtain controls in the custom OCR layoutButton customOcrButton = ocrView.findViewById(R.id.custom_ocr_button_id);if (customOcrButton != null) {customOcrButton.setOnClickListener(v -> {// Handle custom button click eventsLog.d(TAG, "Custom OCR button clicked");});}}@Overridepublic void onMainViewDestroy() {// Cleanup upon page destructionLog.d(TAG, "OCR view destroyed");}});
huiyan_fragment_authing.xml, place the originally independent txy_cancel_txt_btn into the navigation bar container and add a title text. Note that the ID of txy_cancel_txt_btn must be retained, as the SDK will automatically bind a click event to it to exit the liveness verification process.<!-- Custom navigation bar container, where background color and height can be freely configured --><FrameLayoutandroid:id="@+id/custom_nav_bar"android:layout_width="match_parent"android:layout_height="56dp"android:background="#2196F3"app:layout_constraintTop_toTopOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintEnd_toEndOf="parent"><!-- Back button: The ID must be txy_cancel_txt_btn, as the SDK will bind the exit event to it --><TextViewandroid:id="@+id/txy_cancel_txt_btn"android:layout_width="24dp"android:layout_height="24dp"android:layout_gravity="center_vertical|start"android:layout_marginStart="15dp"android:background="@drawable/ic_arrow_left" /><!-- Custom title: The ID can be customized, and the text needs to be updated in onMainViewCreate --><TextViewandroid:id="@+id/custom_nav_title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:text="Face Verification"android:textColor="@android:color/white"android:textSize="18sp" /></FrameLayout>
FaceAuthUiConfig faceAuthUiConfig = new FaceAuthUiConfig();faceAuthUiConfig.setAuthLayoutResId(R.layout.custom_face_auth_layout);faceAuthUiConfig.setStatusBarColor(color); // Set the status bar background color, usually consistent with the custom navigation bar's backgroundEkycHyConfig ekycHyConfig = new EkycHyConfig();ekycHyConfig.setFaceAuthUiConfig(faceAuthUiConfig);
フィードバック