简体   繁体   中英

Android TTS from code itself - not user input

I want to use the TTS service to speak out text messages I have written in the code itself such as:

header.setText("Hello!");

I saw TTS from user input, but I do not want this.

I have checked these links by the way:

http://viralpatel.net/blogs/android-speech-to-text-api/

http://www.androidhive.info/2012/01/android-text-to-speech-tutorial/

But not really what I want.

You can label your element with contentDescription .

Java example:

myButton.setContentDescription("My text to speech");

XML example:

<LinearLayout
    .... >
    <ImageView
        ....
        android:contentDescription="My text to speech" />
</LinearLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM