[是否可以通过编程方式设置为在触发某些操作(例如单击按钮时)时读取对讲中的所有视图,就像您一次用三根手指点击时一样?
提前感谢。
选项1-如果您只想阅读一些文本:用语音朗读文本
请参考this answer
文本到语音内置于Android 1.6+中。这是一个简单的示例。
TextToSpeech tts = new TextToSpeech(this, this);
tts.setLanguage(Locale.US);
tts.speak("Text to say aloud", TextToSpeech.QUEUE_ADD, null);
更多信息:http://android-developers.blogspot.com/2009/09/introduction-to-text-to-speech-in.html
选项2-如果您对使用对讲有丝毫兴趣
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "pkgname/classname");
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, "1");
其中pkgname是您的软件包名称,而classname是您的辅助服务的类名称。
如果需要启用多个服务,或者不想破坏以前的设置,则可能要使用:来分隔其他服务。
此外,您可能需要作为系统应用程序运行,并且可能需要以下权限
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
这可能不适用于某些版本的Android。
也请参考this question的其他答案
PS。如果它不起作用,也许您可以在/data/data/com.android.providers.settings/databases/settings.db/secure中找到运气,这是Android存储安全设置的地方。