Android文字转语音-突出语音文字

问题描述 投票:0回答:1

在我的UtteranceProgressListener中,我已覆盖onRangeStart,但未得到调用。

       @Override
        public void onRangeStart(String utteranceId, int start, int end, int frame) {
            super.onRangeStart(utteranceId, start, end, frame);

            Spannable wordToSpan = new SpannableString(smartOcrDisplayTextLeft.getText());
            wordToSpan.setSpan(new ForegroundColorSpan(Color.GREEN), start, end, Spanned.SPAN_INCLUSIVE_INCLUSIVE);

            smartOcrDisplayTextLeft.setText(wordToSpan);

        }
android text-to-speech
1个回答
0
投票

好的,代码正确。从设置->辅助功能,您需要选择Google作为文本到语音引擎。

© www.soinside.com 2019 - 2024. All rights reserved.