Android Studio开发TTS功能,通过TextToSpeech类实现输入文字的中文语音播放
发布时间
阅读量:
阅读量
安卓TextToSpeech技术应用
Android系统支持将文字内容转化为语音输出功能。用户不仅能够实现文本到语音的转换,还可通过多种语言进行播报。针对这一功能,Android平台内置了TextToSpeech类作为实现途径。若要应用该类,需首先创建其对象实例,并设置相应的初始化监听器initListener。
创建 Empty Activity
我选择的API24,支持安卓7.0及以上的操作系统。
修改默认的 activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:transitionGroup="true">
<TextView
全部评论 (0)
还没有任何评论哟~
