【发布时间】:2021-04-29 18:55:05
【问题描述】:
我正在使用 Android Studio。代码java.我想把TextToSpeech语言变成土耳其语。我怎样才能把语音变成土耳其语?
我的代码:
TextToSpeech textToSpeech ;
ImageView ımagespeech;
textToSpeech = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int i) {
if (i !=TextToSpeech.ERROR){
textToSpeech.setLanguage(new Locale("en_US"));
textToSpeech.setSpeechRate((float)1.0);
}
}
});
ımagespeech.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String gettext =tvtcontextt.getText().toString();
textToSpeech.speak(gettext,TextToSpeech.QUEUE_FLUSH,null);
}
});
@Override
protected void onPause() {
if (textToSpeech != null ){
textToSpeech.stop();
textToSpeech.shutdown();
}
super.onPause();
}
【问题讨论】:
-
你试过用“tr_TR”代替“en_US”吗?
-
也检查this out
-
@MehranB 是的,我试过了,但它不会说话。不说什么。链接也没有发生
标签: android android-studio text-to-speech speech-to-text voice-recognition