Android自带语音播报

 

import android.speech.tts.TextToSpeech;


tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
    @Override
    public void onInit(int status) {
        //初始化成功的话,设置语音
        if (status == TextToSpeech.SUCCESS) {
            tts.setLanguage(Locale.CHINESE);
            tts.speak("左偏120度 右偏86度", TextToSpeech.QUEUE_FLUSH, null);
        }
    }
});

猜你喜欢

转载自blog.csdn.net/yxpandjay/article/details/81503116
今日推荐