提交 f3248685 编写于 作者: G gaoxiang

add switchinput docs

Signed-off-by: Ngaoxiang <gaoxiang75@huawei.com>
上级 6ccdb6bb
......@@ -72,7 +72,48 @@ getInputMethodSetting(): InputMethodSetting
```js
var InputMethodSetting = inputMethod.getInputMethodSetting();
```
## inputMethod.switchInputMethod<sup>9+</sup>
switchInputMethod(target: InputmethodProperty, callback: AsyncCallback&lt;boolean&gt;): void;
**系统能力**:SystemCapability.Miscservices.InputMethodFramework
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
|target | InputmethodProperty | 是 | 传入要切换的目标输入法。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 返回输入法切换是否成功。 |
**示例:**
```js
inputMethod.switchInputMethod({packageName:"com.ohos.inputApp", methodId:"InputDemoService"}).then(res => {
prompt.showToast({message:"切换输入法成功" + this.imeList[this.flag].packageName, duration: 200});
});
```
switchInputMethod(target: InputmethodProperty): Promise&lt;boolean&gt;
**系统能力**: SystemCapability.Miscservices.InputMethodFramework
**返回值:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
|target | InputmethodProperty | 是 | 传入要切换的目标输入法。 |
**示例:**
```js
inputMethod.switchInputMethod({packageName:"com.ohos.inputApp", methodId:"InputDemoService"}).then(res => {
prompt.showToast({message:"切换输入法成功" + this.imeList[this.flag].packageName, duration: 200});
});
```
## InputMethodController
下列API示例中都需使用[getInputMethodController](#getInputMethodController)回调获取到InputMethodController实例,再通过此实例调用对应方法。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册