我正在處理文本到語音應用程序,但我遇到了一個問題,我無法知道TTS正在說的當前單詞。有什麼方法可以找到這個?突出顯示TTS引擎正在說的當前單詞
例如:如果TTS正在說這個字符串:問題可能已經有您的答案,並且當它已達到'已經'時,我該如何突出'已經'。
我正在處理文本到語音應用程序,但我遇到了一個問題,我無法知道TTS正在說的當前單詞。有什麼方法可以找到這個?突出顯示TTS引擎正在說的當前單詞
例如:如果TTS正在說這個字符串:問題可能已經有您的答案,並且當它已達到'已經'時,我該如何突出'已經'。
我建議TextToSpeech.speak()的在使用順序:
現在只剩How to detect that synthesizing of a word has finished?
使用TextToSpeech.setOnUtteranceCompletedListener()
檢測話語已完成。
你可以看到這些網頁瞭解詳情:
How to know when TTS is finished?
An introduction to Text-To-Speech in Android
Put it in handler.Create two handler one for to add ;
tts1.speak("your text to speech", TextToSpeech.QUEUE_FLUSH, null);
viewItem.setBackgroundColor(Color.RED);
view item means your textview....
and add another handler...
and make your view as transparent..
viewItem.setBackgroundColor(Color.TRANSPARENT);
it's work for me perfectly....
好主意 - 不幸的是我不知道如何做到這一點... – Ridcully
你做了嗎? –