2012-04-18 56 views
0

查看圖像下方如何在TTS android中設置更多語言?

enter image description here

enter image description here

請參閱圖像.. 首先我按點擊說話,然後打開收音機按鈕,然後選擇語言.. 後,當我選擇英語,然後必須用英文轉換。 只需選擇一種語言,然後用相同的蹩腳語言進行轉換。 可能嗎?如何?

我會等待回答它緊急的一切。

感謝

回答

2

試試這個

private TextToSpeech mTts; 
protected void onActivityResult(
     int requestCode, int resultCode, Intent data) { 
    if (requestCode == MY_DATA_CHECK_CODE) { 
     if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { 
      // success, create the TTS instance 
      mTts = new TextToSpeech(this, this); 
     } else { 
      // missing data, install it 
      Intent installIntent = new Intent(); 
      installIntent.setAction(
       TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); 
      startActivity(installIntent); 
     } 
    } 
} 

// 和編寫代碼的語言

mTts.setLanguage(Locale.US); 
mTts.isLanguageAvailable(Locale.UK)) 

mTts.isLanguageAvailable(Locale.FRANCE)) 

mTts.isLanguageAvailable(new Locale("spa", "ESP"))) 

// 讓你的文字speack

String myText1 = "Did you sleep well?"; 
String myText2 = "I hope so, because it's time to wake up."; 
mTts.speak(myText1, TextToSpeech.QUEUE_FLUSH, null); 
mTts.speak(myText2, TextToSpeech.QUEUE_ADD, null);