Android TalkBack无法正确读取Webview中的电话号码 [英] Android TalkBack reading phone numbers in Webview incorrectly

查看:202
本文介绍了Android TalkBack无法正确读取Webview中的电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WebView中读取电话号码时,我对TalkBack屏幕阅读器服务有点头疼,而且似乎找不到解决方法。这是我正在阅读WebView的一些html代码的片段:

I'm having a minor headache with the TalkBack screen reader service when reading phone numbers in a WebView, and I can't seem to find a solution. This is a snippet of some html code that I am reading into the WebView:

<li>Call <a href="tel:18007848669">1-800-QUIT-NOW(1-800-784-8669)</a> for phone support</li>

屏幕阅读器将其显示为呼叫1至800退出,现在1至800链接。有没有办法强迫它/信号以不同的方式阅读它?我需要以一种更自然的格式来阅读它,即一百八十。

The screen reader reads this as "Call one to eight hundred quit now one to eight hundred link". Is there a way to force it/signal to read it differently? I need it to be read in a more natural format, i.e. "One Eight Hundred".

推荐答案

使用以下辅助功能选项您的editText或textView

Use the following Accessibility Deligate for your editText or textView

@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(host, info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {

        switch (host.getId()) {
            case R.id.tv_bookingID:
                if (((TextView) host).getText().length() > 1) {
                    sb.delete(0, sb.length());
                    for (char c : ((TextView) host).getText().toString().toCharArray()) {
                        sb.append(c).append(" ");
                    }
                    //change text for talkback
                    info.setText(null);
                    info.setContentDescription(sb.toString().trim());

                }
                break;
        }//switch
    }//if
}

这篇关于Android TalkBack无法正确读取Webview中的电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆