如何自己设置添加到系统设置? [英] How to add own setting to system settings?

查看:93
本文介绍了如何自己设置添加到系统设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到,管理自己的复选框添加到系统设置无需root访问

例如,安装了新的TTS引擎时,它都将自己的项目到语音输入和放大器;输出> 文本到语音的设置屏幕:

他们是怎么做到的?

如果我想我自己的设置添加到文本到语音的设置屏幕上,什么钩,API和/或文件,我应该找谁?

解决方案
  

他们是怎么做到的?

通过检查SDK中的 TtsEngine 示例应用程序,这样看来,其过程是:

步骤#1:实现TTS服务。谁尝试使用此工具挂钩任意其他的东西进入设置开发人员将拍摄视线。

步骤2:在该服务的清单项,有一个<元数据> 元素的android:名字=机器人.speech.tts机器人:资源属性指向一个XML资源

第三步:创建上述XML资源,类似于以下内容:

 < TTS引擎的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
  机器人:settingsActivity =your.settings.activity.GoesHere/>
 

唉,这似乎是无证。至少 - 我没有找到这个东西,任何引用,当我搜索的在线开发指南。

I have seen applications that manage to add their own checkboxes to system settings without requiring root access.

For example, when a new TTS engine is installed, it adds its own items to the Voice input & output > Text-to-speech settings screen:

How do they do that?

If I want to add my own setting to that Text-to-speech settings screen, what hook, API and/or documentation should I be looking for?

解决方案

How do they do that?

By examining the TtsEngine sample app in the SDK, it would appear that the process is:

Step #1: Implement a TTS service. Developers who attempt to use this facility to hook arbitrary other stuff into Settings will be shot on sight.

Step #2: In the manifest entry for that service, have a <meta-data> element with android:name="android.speech.tts" and an android:resource attribute pointing to an XML resource.

Step #3: Create the aforementioned XML resource, akin to the following:

<tts-engine xmlns:android="http://schemas.android.com/apk/res/android"
  android:settingsActivity="your.settings.activity.GoesHere" />

Alas, this appears to be undocumented. Leastways, I'm not finding any references to this stuff when I search the online developer guide.

这篇关于如何自己设置添加到系统设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆