首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android关于 text_to_speach的施用(tts)

2012-08-22 
android关于 text_to_speach的使用(tts)主要用到两个包import android.speech.tts.TextToSpeechimport an

android关于 text_to_speach的使用(tts)

主要用到两个包

import android.speech.tts.TextToSpeech;

import android.speech.tts.TextToSpeech.OnInitListener;

其中必须实现OnInitListener里面的方法

 OnClickListener mSubmitListener = new OnClickListener() {public void onClick(View v) {//Log the second parameter with the first parameter as the tag.//Note: Window -> Show View... -> Other -> LogCat to view the log in EclipseLog.i("TTS_TEST", "Button clicked - Attempting to speak");//On button click, say whatever is in the textFieldtts.speak(vText.getText().toString(), TextToSpeech.QUEUE_FLUSH, null);}};

?

TextToSpeech.Engine.ACTION_CHECK_TTS_DATA

这里一定要注意TextToSpeech.Engine下的几个常量。

源码来源于网络

热点排行